diff --git a/teil13/.gitignore b/teil13/.gitignore new file mode 100644 index 0000000..c7fb3aa --- /dev/null +++ b/teil13/.gitignore @@ -0,0 +1,2 @@ +./__pycache__ +./network/__pycache__/* diff --git a/teil13/fibclient.py b/teil13/fibclient.py index 35a9744..5a1d802 100644 --- a/teil13/fibclient.py +++ b/teil13/fibclient.py @@ -2,14 +2,19 @@ # fibclient.py import socket import time -from network.const import __ADDRESS__ +#from network.const import __ADDRESSREMOTE__ +#from network.const import __ADDRESSLOCAL__ +from network import __ADDRESSLOCAL__ DISCONNECT_MESSAGE = "!DISCONNECT" # Verbindung herstellen def connect(): client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - client.connect(__ADDRESS__) +# für fibserver auf einem Remote-Pi +# client.connect(__ADDRESSREMOTE__) +# für fibserver auf lokalem Pi (import oben beachten!) + client.connect(__ADDRESSLOCAL__) return client # msg senden diff --git a/teil13/fibserver.py b/teil13/fibserver.py index f5d2229..2302ce9 100755 --- a/teil13/fibserver.py +++ b/teil13/fibserver.py @@ -2,13 +2,13 @@ import socket import threading -from network.const import __ADDRESS__ +from network import __ADDRESSLOCAL__ # Server-Socket aufbauen server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Socket an unsere Server-Adresse binden -server.bind(__ADDRESS__) +server.bind(__ADDRESSLOCAL__) # Set mit den verbundenen Clients clients = set() diff --git a/teil13/network/__init__.py b/teil13/network/__init__.py index 8b13789..b024592 100644 --- a/teil13/network/__init__.py +++ b/teil13/network/__init__.py @@ -1 +1,3 @@ +from .const import __ADDRESSLOCAL__ +from .const import __ADDRESSREMOTE__ diff --git a/teil13/network/__pycache__/__init__.cpython-39.pyc b/teil13/network/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 4eef26b..0000000 Binary files a/teil13/network/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/teil13/network/__pycache__/const.cpython-39.pyc b/teil13/network/__pycache__/const.cpython-39.pyc deleted file mode 100644 index ad3ffcb..0000000 Binary files a/teil13/network/__pycache__/const.cpython-39.pyc and /dev/null differ diff --git a/teil13/network/const.py b/teil13/network/const.py index a08a9fb..9a77011 100644 --- a/teil13/network/const.py +++ b/teil13/network/const.py @@ -6,7 +6,14 @@ import socket __PORT__ = 6554 #Server-IP -__SERVER__ = socket.gethostbyname(socket.gethostname()) +# 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) -__ADDRESS__ = (__SERVER__,__PORT__) +#lokal +__ADDRESSLOCAL__ = (__SERVERLOCAL__,__PORT__) +#remote +__ADDRESSREMOTE__ = (__SERVERREMOTE__,__PORT__)