MEIM/prakt1_socket_client

16 lines
279 B
Plaintext
Raw Permalink Normal View History

2018-10-15 17:12:01 +02:00
import socket
s = socket.socket()
host = socket.gethostname()
port = 21345
s.connect((host, port))
bytes = s.recv(1024)
print(bytes.decode('utf-8'))
msg = input('Hier Eingabe: ')
msg = msg.encode('utf-8')
s.send(msg)
bytes = s.recv(1024)
print(bytes.decode('utf-8'))
s.close()