Re: Buffer size when receiving data through a socket?
- From: "John Salerno" <johnjsal@xxxxxxxxxxxxxxx>
- Date: Wed, 18 Jun 2008 09:56:29 -0400
"Dennis Lee Bieber" <wlfraed@xxxxxxxxxxxxx> wrote in message
news:vrudnYYHF6EnLcXVnZ2dnUVZ_oPinZ2d@xxxxxxxxxxxxxxxx
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. :)
.
- References:
- Buffer size when receiving data through a socket?
- From: John Salerno
- Re: Buffer size when receiving data through a socket?
- From: John Salerno
- Buffer size when receiving data through a socket?
- Prev by Date: ZFS bindings
- Next by Date: Re: One more socket programming question
- Previous by thread: Re: Buffer size when receiving data through a socket?
- Next by thread: Re: Buffer size when receiving data through a socket?
- Index(es):
Relevant Pages
|