Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'socket': 0.07; 'stops': 0.07; 'friday,': 0.09; 'block.': 0.16; 'chris,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:programming': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'stopping': 0.24; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'disable': 0.31; 'probably': 0.32; 'running': 0.33; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'thanks': 0.36; 'should': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'here': 0.66; 'anything.': 0.68; 'connection.': 0.74; 'effectively,': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=dOEmrhyBSdjydHy5FyFKxBNf3bFje0fqqKAsVNpMQQE=; b=MYnzHJRVH6yVmGF65zOyCSsF70sT8+Bl3Pnvmg6eLlMHVySaUe0lJzUmVfsEIFahW5 yDKLuWSxmB5HYC1HtM1psB6cc26tX6B/1HYRU4Fn9jEIqBorTKaAaU90O7bGrXeLLZcd GWNlT6YVh8tF/JE2Z1e+lStBvywAAIN8AZaIkmS+kdCQhjjKGhSSDua93wcJMmm2mufS hAoRyHA9wr+qsLbq4Rr97eP+zvuQrId06NnqcSA2yj0xZpDQXAxDtGp5Yo9oqdKEb8Qy 4SBE0/cZHtaPsbVUnQwt5VTkQrInVxfzJOh6f13YDQ34lklOWgIWt5xsvQC1sfyzqQFQ FaDA== MIME-Version: 1.0 X-Received: by 10.52.37.109 with SMTP id x13mr3899132vdj.10.1367639761677; Fri, 03 May 2013 20:56:01 -0700 (PDT) In-Reply-To: References: <4aef55bd-f550-4a3d-b11a-285b6fa9892b@googlegroups.com> Date: Sat, 4 May 2013 13:56:01 +1000 Subject: Re: socket programming From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367639769 news.xs4all.nl 15999 [2001:888:2000:d::a6]:55043 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44701 On Sat, May 4, 2013 at 1:37 PM, Pedro 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