1#Server Side
2import socket
3sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
4host = socket.gethostname()
5port = 5555
6sock.bind((host, port))
7sock.listen(1)
8conn, addr = sock.accept()
9data = "Hello!"
10data = bytes(data, 'utf-8')
11conn.send(data)
12sock.close()
13
14#Client
15import socket
16sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
17host = socket.gethostname()
18port = 5555
19sock.connect((host, port))
20data = sock.recv(2048)
21data = str(data, "utf-8")
22sock.close()
23