Version_FINAL
This commit is contained in:
parent
482071b44a
commit
dcc0a926f2
@ -4,17 +4,14 @@ SOCKET = socket.socket()
|
||||
HOST = socket.gethostname()
|
||||
PORT = 45670
|
||||
|
||||
# Verbindung zum Server
|
||||
SOCKET.connect((HOST, PORT))
|
||||
|
||||
|
||||
while True:
|
||||
eingabe = input("Eingabe: ")
|
||||
msg = eingabe.encode("utf-8")
|
||||
|
||||
SOCKET.send(msg)
|
||||
|
||||
|
||||
if eingabe.upper() == "STOP":
|
||||
SOCKET.close()
|
||||
break
|
||||
@ -24,6 +21,4 @@ while True:
|
||||
|
||||
print(msg)
|
||||
|
||||
|
||||
|
||||
SOCKET.close()
|
@ -4,16 +4,15 @@ SOCKET = socket.socket()
|
||||
HOST = socket.gethostname()
|
||||
PORT = 45670
|
||||
|
||||
|
||||
SOCKET.bind((HOST, PORT))
|
||||
SOCKET.listen()
|
||||
|
||||
|
||||
while True:
|
||||
(connection, addr) = SOCKET.accept()
|
||||
|
||||
print("Server: " + addr[0] + " Port: " + str(addr[1]))
|
||||
|
||||
while True:
|
||||
eingabe = connection.recv(1024)
|
||||
|
||||
msg = eingabe.decode("utf-8")
|
||||
@ -22,11 +21,10 @@ while True:
|
||||
print(msg)
|
||||
|
||||
if msg == "STOP":
|
||||
connection.close()
|
||||
SOCKET.close()
|
||||
break
|
||||
|
||||
connection.send(msg.encode("utf-8"))
|
||||
|
||||
connection.close()
|
||||
|
||||
SOCKET.close()
|
Loading…
x
Reference in New Issue
Block a user