Basic client/server with sockets
Brian Quinlan
brian at sweetapp.com
Mon Feb 10 17:30:31 EST 2003
[code snipped]
> there is a simple server that simply sends back whatever i type in
> raw_input, but the problem is that everytime i hit ENTER without
> typing anything, the s.recv(n) hangs the server... i noticed that if
> the server don't send anything it simply hangs in the recv()
> function...
>
> what am i doing wrong? is this the right way to do this? shound't it
> just return nothing if the buffer is empty?
Calls to receive block until some data is received. See:
http://www.python.org/doc/current/lib/socket-objects.html
The description of setblocking might help you.
Cheers,
Brian
More information about the Python-list
mailing list