Bug in select

Ron Garret rNOSPAMon at flownet.com
Sun Apr 22 17:22:20 EDT 2007


In article <1aGdndBf1ON7UrbbnZ2dnUVZ_hjinZ2d at speakeasy.net>,
 Erik Max Francis <max at alcyone.com> wrote:

> Ron Garret wrote:
> 
> > So this is clearly a bug, but surely I'm not the first person to have 
> > encountered this?  Is there a known workaround?
> 
> It's hard to see how this demonstrates a bug in anything, since you're 
> telnetting to the wrong port in your example.

Geez you people are picky.  Since I ran this several times I ran into 
the TIM_WAIT problem.  Here's the actual transcript:

Python 2.5 (r25:51908, Mar  1 2007, 10:09:05) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import *
>>> from select import select
>>> s=socket(AF_INET, SOCK_STREAM)
>>> s.bind(('',8080))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')
>>> s.bind(('',8081))
>>> s.listen(5)
>>> f = s.accept()[0].makefile()
>>> f.readline()
'123\r\n'
>>> select([f],[],[],1)
([], [], [])
>>> f.readline()
'321\r\n'



More information about the Python-list mailing list