[Python-Dev] socket listen problem under aix

Dave Cole djc at object-craft.com.au
Mon Nov 10 17:45:54 EST 2003


On Tue, 2003-11-11 at 06:38, Michael Petroni wrote:
> hi!
> 
> sorry for posting here as a non-member and non-developer, but i've a 
> problem that is (maybe) a bug:
> 
> i'm running python 2.2.3 under aix 4.3.3 compiled with gcc version 
> 2.9-aix51-020209.
> 
> subsequent accept calls in the socket library block after a defined 
> number of calls depending on the accept queue size. the call then never 
> returns, a connection to the server port gets a timeout and netstat -a 
> still shows the port as listening.
> 
> see the following example code:
> 
> ----
> import socket
> queue_size = 6
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.bind(("", 7111))
> s.listen(queue_size)
> while 1:
> 	(c, addr) = s.accept()
> 	c.close()
> ----

It may not have any effect but try changing the socket call to this:

  socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)

I recently wrote a non-blocking select loop server (in C) on AIX 4.3.3
and the program would run for hours then fail in strange ways.  When I
changed the socket() protocol argument from zero to IPROTO_TCP the
problems went away.

It is a long shot, but it is worth a try.

- Dave

-- 
http://www.object-craft.com.au




More information about the Python-Dev mailing list