Re: Buffer size when receiving data through a socket?



"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. :)


.



Relevant Pages

  • Re: getting a threads state and CPU utilization
    ... of CPU time currently being used)? ... How could you tell an infinite loop from a polling loop ... responding to continuous messages from many client apps, ... though the customer *claims* that the client app is disconnecting (I suspect ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Is Message passing good approach for multi-threaded applications?
    ... that it's hard to even create an artificial case where select loop is ... client gets to wait while each file read for that client blocks. ... And never ever blocking on pain of death doesn't introduce overhead ... This is from lots of painful experience. ...
    (comp.unix.programmer)
  • Re: OnPaint, SetWindowPos and recursion
    ... if the client area is smaller than the window size, he'll never get anything to fit so it ... size and the client size will be different. ... I call SetWindowPos but when I do that I enter an infinite loop and my ... csText = csText.Mid; ...
    (microsoft.public.vc.mfc)
  • Re: One-way transmission on a T3
    ... to a hard loop at the handoff. ... I continue to suggest to the client that the problem is in the cloud, ... DS3 pre-equalizer build out in the MUX equipment at your end may be too ... cables that support DS3 services. ...
    (comp.dcom.telecom.tech)
  • Re: multiple tcp server and client execution with close problem
    ... while loop to accept ... Why is theserverstill waiting for the client? ... The server is still waiting because there is another function calling ...
    (comp.unix.programmer)