Olli Graf
2 years ago
14 changed files with 70 additions and 2 deletions
@ -0,0 +1,2 @@ |
|||||
|
./__pycache__ |
||||
|
./network/__pycache__/* |
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
2023-04-29 10:49:08,638 [DEBUG] <module>: MAIN: start |
@ -0,0 +1,32 @@ |
|||||
|
#! /usr/bin/python3 |
||||
|
from http.server import BaseHTTPRequestHandler,HTTPServer |
||||
|
import logging |
||||
|
|
||||
|
logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', filename='ledserver.log', level=logging.DEBUG) |
||||
|
class http_server: |
||||
|
def __init__(self): |
||||
|
def handler(*args): |
||||
|
myHandler(*args) |
||||
|
server = HTTPServer(('', 8080), handler) |
||||
|
|
||||
|
class myHandler(BaseHTTPRequestHandler): |
||||
|
def __init__(self,*args): |
||||
|
self.t1 = t1 |
||||
|
BaseHTTPRequestHandler.__init__(self, *args) |
||||
|
|
||||
|
def do_GET(self): |
||||
|
logging.debug('GET: empfangen') |
||||
|
self.send_response(200) |
||||
|
self.send_header('Content-type','text/html') |
||||
|
self.end_headers() |
||||
|
self.wfile.write(self.t1.show()) #Doesnt work |
||||
|
return |
||||
|
|
||||
|
class main: |
||||
|
def __init__(self): |
||||
|
|
||||
|
self.server = http_server() |
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
logging.debug('MAIN: start') |
||||
|
main() |
@ -0,0 +1,3 @@ |
|||||
|
from .const import __ADDRESSLOCAL__ |
||||
|
#from .const import __ADDRESSREMOTE__ |
||||
|
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,10 @@ |
|||||
|
def receive(conn): |
||||
|
msg = conn.recv(64).decode('utf-8') |
||||
|
|
||||
|
return msg |
||||
|
|
||||
|
def send(client, msg): |
||||
|
message = msg.encode('utf-8') |
||||
|
client.send(message) |
||||
|
|
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
#network/const.py |
||||
|
|
||||
|
import socket |
||||
|
|
||||
|
# TCP Port |
||||
|
__PORT__ = 6554 |
||||
|
|
||||
|
#Server-IP |
||||
|
# für den Server (immer localhost) |
||||
|
__SERVERLOCAL__ = socket.gethostbyname(socket.gethostname()) |
||||
|
|
||||
|
#für Server auf einem Remote-Pi |
||||
|
#__SERVERREMOTE__ = socket.gethostbyname('gabbo') |
||||
|
|
||||
|
# Server-Adresse (IP,Port) |
||||
|
#lokal |
||||
|
__ADDRESSLOCAL__ = (__SERVERLOCAL__,__PORT__) |
||||
|
#remote |
||||
|
#__ADDRESSREMOTE__ = (__SERVERREMOTE__,__PORT__) |
Loading…
Reference in new issue