Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44701

Re: socket programming

References <4aef55bd-f550-4a3d-b11a-285b6fa9892b@googlegroups.com> <mailman.1282.1367634220.3114.python-list@python.org> <c8534264-c126-4627-92b8-4aac056f81e3@googlegroups.com>
Date 2013-05-04 13:56 +1000
Subject Re: socket programming
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1283.1367639769.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, May 4, 2013 at 1:37 PM, Pedro <pedro@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

socket programming Pedro <pedro@ncf.ca> - 2013-05-03 19:13 -0700
  Re: socket programming Chris Angelico <rosuav@gmail.com> - 2013-05-04 12:23 +1000
    Re: socket programming Pedro <pedro@ncf.ca> - 2013-05-03 20:37 -0700
      Re: socket programming Chris Angelico <rosuav@gmail.com> - 2013-05-04 13:56 +1000
        Re: socket programming Pedro <pedro@ncf.ca> - 2013-05-03 21:03 -0700
  Re: socket programming Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-05-04 11:37 +0200
    Re: socket programming Chris Angelico <rosuav@gmail.com> - 2013-05-04 20:00 +1000
    Re: socket programming Pedro <pedro@ncf.ca> - 2013-05-06 08:54 -0700
      Re: socket programming Chris Angelico <rosuav@gmail.com> - 2013-05-07 02:05 +1000
      Re: socket programming Arnaud Delobelle <arnodel@gmail.com> - 2013-05-06 19:54 +0100

csiph-web