Browse Source

_pycache__ gelöscht

network Package mit __init__.py ausgestattet.
develop
Raspithek 2 years ago
parent
commit
c8ea31042e
  1. 2
      teil13/.gitignore
  2. 9
      teil13/fibclient.py
  3. 4
      teil13/fibserver.py
  4. 2
      teil13/network/__init__.py
  5. BIN
      teil13/network/__pycache__/__init__.cpython-39.pyc
  6. BIN
      teil13/network/__pycache__/const.cpython-39.pyc
  7. 11
      teil13/network/const.py

2
teil13/.gitignore

@ -0,0 +1,2 @@
./__pycache__
./network/__pycache__/*

9
teil13/fibclient.py

@ -2,14 +2,19 @@
# fibclient.py # fibclient.py
import socket import socket
import time import time
from network.const import __ADDRESS__ #from network.const import __ADDRESSREMOTE__
#from network.const import __ADDRESSLOCAL__
from network import __ADDRESSLOCAL__
DISCONNECT_MESSAGE = "!DISCONNECT" DISCONNECT_MESSAGE = "!DISCONNECT"
# Verbindung herstellen # Verbindung herstellen
def connect(): def connect():
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 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 return client
# msg senden # msg senden

4
teil13/fibserver.py

@ -2,13 +2,13 @@
import socket import socket
import threading import threading
from network.const import __ADDRESS__ from network import __ADDRESSLOCAL__
# Server-Socket aufbauen # Server-Socket aufbauen
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#Socket an unsere Server-Adresse binden #Socket an unsere Server-Adresse binden
server.bind(__ADDRESS__) server.bind(__ADDRESSLOCAL__)
# Set mit den verbundenen Clients # Set mit den verbundenen Clients
clients = set() clients = set()

2
teil13/network/__init__.py

@ -1 +1,3 @@
from .const import __ADDRESSLOCAL__
from .const import __ADDRESSREMOTE__

BIN
teil13/network/__pycache__/__init__.cpython-39.pyc

Binary file not shown.

BIN
teil13/network/__pycache__/const.cpython-39.pyc

Binary file not shown.

11
teil13/network/const.py

@ -6,7 +6,14 @@ import socket
__PORT__ = 6554 __PORT__ = 6554
#Server-IP #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) # Server-Adresse (IP,Port)
__ADDRESS__ = (__SERVER__,__PORT__) #lokal
__ADDRESSLOCAL__ = (__SERVERLOCAL__,__PORT__)
#remote
__ADDRESSREMOTE__ = (__SERVERREMOTE__,__PORT__)

Loading…
Cancel
Save