You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classCommandTCPHandler(SocketServer.StreamRequestHandler):
defhandle(self):
# self.rfile is a file-like object created by the handler;# we can now use e.g. readline() instead of raw recv() callsself.data=self.rfile.readline().strip()
print"{} wrote:".format(self.client_address[0])
printself.data# Likewise, self.wfile is a file-like object used to write back# to the clientself.wfile.write('123')
if__name__=="__main__":
HOST, PORT="localhost", 1234# Create the server, binding to localhost on port 1234server=SocketServer.TCPServer((HOST, PORT), CommandTCPHandler)
# Activate the server; this will keep running until you# interrupt the program with Ctrl-Cserver.serve_forever()
I ran the python server and then the lua client. The client never receives anything and times out all 10 times, while the server got 'hello there' all 10 times.
$> th tcp-client.lua
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
done
Server log:
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
127.0.0.1 wrote:
hello there ..
The text was updated successfully, but these errors were encountered:
I have a python TCP server adapted from the example in https://docs.python.org/2/library/socketserver.html.
I have a client written in lua with async
I ran the python server and then the lua client. The client never receives anything and times out all 10 times, while the server got 'hello there' all 10 times.
Server log:
The text was updated successfully, but these errors were encountered: