summaryrefslogtreecommitdiff
path: root/server/client.py
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-22 17:48:07 +0800
committerTeddy <[email protected]>2013-08-22 17:48:07 +0800
commit3a7a46b33cb7654ebb1a3f8f85ae4f0b8de78f88 (patch)
treea74710b1a196165b23ff51c926d643f66a9dd667 /server/client.py
parent87db3a38a7e18fc3870ab2e55e7e8d57efa06fe9 (diff)
added demo server
Diffstat (limited to 'server/client.py')
-rw-r--r--server/client.py31
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])