Buffer size when receiving data through a socket?
johnjsal at NOSPAMgmail.com
Wed Jun 18 15:56:29 CEST 2008
"Dennis Lee Bieber" <wlfraed at ix.netcom.com> wrote in message
news:vrudnYYHF6EnLcXVnZ2dnUVZ_oPinZ2d at earthlink.com...
> The first if is checking for lack of interactive input -- and, as
> coded, will never break out as ANY response to the > prompt will have a
> newline attached.
> Try with raw_input("> ").strip() instead
Well, I know the first if block works properly. Pressing just ENTER will
exit the loop and close the client socket.
> The second if is checking for empty receive block... And since
> .recv() blocks until it has something to return (as I recall) it may not
> be of use...
Interesting point. I'm not sure if it works that way though. I *think* I
tried sending an empty string from the server back to the client, and as
expected it exited the loop and closed the client, which doesn't make sense
to me, since an empty string could be perfectly valid return data.
I opted to remove the second if statement and see where that takes me. :)
More information about the Python-list