aboutsummaryrefslogtreecommitdiff
path: root/python/server.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpython/server.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/server.py b/python/server.py
new file mode 100755
index 0000000..c36f073
--- /dev/null
+++ b/python/server.py
@@ -0,0 +1,18 @@
1#!/usr/bin/python
2
3import gats
4import socket
5import time
6
7s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
9s.bind(('', 5051))
10s.listen(1)
11conn, addr = s.accept()
12print 'Connected by', addr
13while 1:
14 print 'Reading...'
15 obj = gats.recv( conn )
16 print 'Read',obj
17 gats.send( {'recvAddr': addr, 'recvTime': time.time(), 'recvObj': obj }, conn )
18conn.close()