This repository has been archived on 2025-08-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
GGS/python_client_reconnect
2011-02-14 19:47:28 +01:00

23 lines
496 B
Python
Executable file

#!/usr/bin/env python
import sys, time, socket
HOST = 'localhost' # The remote host
PORT = int(sys.argv[1]) # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
# Call that function!
print "Calling myFun"
s.send(
"Token: %s\n\
Server-Command: call\n\
Content-Type: text\n\
Content-Length: 6\n\
\n\
myFun" % raw_input("Token >> "))
fs = s.makefile()
data = fs.readline()
print "Data: ", ' '.join(data.split(" ")[1:])
s.close()