socket programming

Pedro pedro at ncf.ca
Sat May 4 00:03:25 EDT 2013


On Friday, May 3, 2013 11:56:01 PM UTC-4, Chris Angelico wrote:
> On Sat, May 4, 2013 at 1:37 PM, Pedro <pedro at ncf.ca> wrote:
> 
> > On Friday, May 3, 2013 10:23:38 PM UTC-4, Chris Angelico wrote:
> 
> >> The accept() call should block. It's not going to spin or anything. If
> 
> >>
> 
> >> you need to monitor multiple sockets, have a look at select().
> 
> >
> 
> > Thanks Chris, can you elaborate on the accept() call should block?
> 
> 
> 
> When you call accept(), your program stops running until there's a
> 
> connection. It's like calling input() (or raw_input()) and your
> 
> program stopping until you type something. You can disable that by
> 
> setting the socket nonblocking, but I don't think you're doing that
> 
> here (and you probably don't want to).
> 
> 
> 
> Consider the accept() call to be, effectively, like reading from the
> 
> bound socket. In many ways it functions that way.
> 
> 
> 
> ChrisA

Brilliant explanation Chris, I swear I read three different docs on that question and could not deduce what you just wrote. Thank you.



More information about the Python-list mailing list