This commit is contained in:
Janko Hartwig 2018-10-15 16:52:39 +02:00
parent 058fd275e4
commit faa0fa5553

19
Prakt1_Socket.py Normal file
View File

@ -0,0 +1,19 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 21345
s.bind((host, port))
s.listen()
while True:
(connection, addr) = s.accept()
print('Verbindung von ', addr)
msg = 'Server sagt Hallo'
connection.send(msg.encode('utf-8'))
msg = connection.recv(1024)
#connection.send(msg)
msg = msg.decode('utf-8')
print(msg)
connection.close()