Ticket #837: openSocketChild.py

File openSocketChild.py, 314 bytes (added by stefanomasini, 10 years ago)
Line 
1
2# Echo client program
3import socket
4
5HOST = 'localhost'    # The remote host
6PORT = 50007              # The same port as used by the server
7s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8s.connect((HOST, PORT))
9s.send('Hello, world')
10data = s.recv(1024)
11s.close()
12print 'Received', repr(data)