Re: Buffer size when receiving data through a socket?

2008-06-21 Thread John Salerno
Dennis Lee Bieber wrote: On Wed, 18 Jun 2008 09:56:29 -0400, "John Salerno" <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: 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 expecte

Re: Buffer size when receiving data through a socket?

2008-06-18 Thread John Salerno
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 kn

Re: Buffer size when receiving data through a socket?

2008-06-18 Thread MRAB
On Jun 18, 7:52 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 17 Jun 2008 09:39:07 -0400, "John Salerno" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > > while True: > > >    data = raw_input('> ') > > >    if not data: > > >        break > > >    client_s

Re: Buffer size when receiving data through a socket?

2008-06-18 Thread Gabriel Genellina
En Tue, 17 Jun 2008 14:32:44 -0300, John Salerno <[EMAIL PROTECTED]> escribió: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Note that most of the time you want to use the sendall() method, because >> send() doesn't guarantee that all the data was actually

Re: Buffer size when receiving data through a socket?

2008-06-18 Thread Gabriel Genellina
En Tue, 17 Jun 2008 14:32:44 -0300, John Salerno <[EMAIL PROTECTED]> escribió: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Note that most of the time you want to use the sendall() method, because >> send() doesn't guarantee that all the data was actually

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread Gabriel Genellina
En Tue, 17 Jun 2008 10:34:24 -0300, John Salerno <[EMAIL PROTECTED]> escribió: > I was wondering about sendall(). The examples I've read in two different > books are consistent in their use of send() and don't even mention > sendall(), so I thought maybe it was for a more specialized situation. «

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Note that most of the time you want to use the sendall() method, because > send() doesn't guarantee that all the data was actually sent. > If I use sendall(), am I

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > from socket import * > > host = 'localhost' > port = 51567 > address = (host, port) > buffer_size = 1024 > > client_socket = socket(AF_INET, SOCK_STREAM) > client_socket.connect(address) > > while True: >data = raw_in

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Both programs say recv(buffer_size) - buffer_size is the maximum number of > bytes to be RECEIVED, that is, READ. recv will return at most buffer_size > bytes. It may return less than that, even if the other side s

Re: Buffer size when receiving data through a socket?

2008-06-16 Thread Gabriel Genellina
En Mon, 16 Jun 2008 21:21:35 -0300, John Salerno <[EMAIL PROTECTED]> escribió: > I wrote some pretty basic socket programming again, but I'm still confused > about what's happening with the buffer_size variable. Here are the server and > client programs: > > -- > > from socket import

Buffer size when receiving data through a socket?

2008-06-16 Thread John Salerno
I wrote some pretty basic socket programming again, but I'm still confused about what's happening with the buffer_size variable. Here are the server and client programs: -- from socket import * host = '' port = 51567 address = (host, port) buffer_size = 1024 server_socket = socket