Gesteuerter Verbindungsabbau (hostname geändert)

This commit is contained in:
Nadege 2019-10-20 20:11:39 +02:00
parent 00834eb1be
commit 89d83fe213
2 changed files with 2 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import socket
s = socket.socket() s = socket.socket()
host = socket.gethostname() host = socket.gethostbyname('localhost')
port = 22225 port = 22225
s.connect((host, port)) s.connect((host, port))
@ -18,5 +18,4 @@ while message != 'STOP':
bytes = s.recv(4096) bytes = s.recv(4096)
print(bytes.decode('utf-8')) print(bytes.decode('utf-8'))
else: else:
print(message)
s.close() s.close()

View File

@ -1,7 +1,7 @@
import socket import socket
s = socket.socket() s = socket.socket()
host = socket.gethostname() host = socket.gethostbyname('localhost')
port = 22225 port = 22225
s.bind((host, port)) s.bind((host, port))
s.listen() s.listen()