_pycache__ gelöscht
network Package mit __init__.py ausgestattet.
This commit is contained in:
2
teil13/.gitignore
vendored
Normal file
2
teil13/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
./__pycache__
|
||||
./network/__pycache__/*
|
@@ -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
|
||||
|
@@ -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()
|
||||
|
@@ -1 +1,3 @@
|
||||
from .const import __ADDRESSLOCAL__
|
||||
from .const import __ADDRESSREMOTE__
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -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__)
|
||||
|
Reference in New Issue
Block a user