diff options
Diffstat (limited to 'server/client.py')
-rw-r--r-- | server/client.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/client.py b/server/client.py new file mode 100644 index 0000000..b1a6d86 --- /dev/null +++ b/server/client.py @@ -0,0 +1,31 @@ +import socket +import sys +from struct import * + +HOST, PORT = "localhost", 9999 +data = "" + +sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + +#data = pack("!B", 0) +#data += "hello" +#data += "\0" +#data += "world" + +#data = pack("!Bll", 1, 1234, 5678) +#data += "hello, world!" + +data = pack("!Bldd", 2, 1234, 123.123, 12323.23222) +print data + +try: + + sock.connect((HOST, PORT)) + sock.sendall(data) + sock.shutdown(socket.SHUT_WR) + received = sock.recv(1024) +finally: + sock.close() + +print "Sent: {}".format(data) +print "Received: {}".format(received[0]) |