socket and os.system

Peter Hansen peter at engcorp.com
Wed Aug 3 21:19:53 CEST 2005


mfaujour wrote:
> I HAVE THIS PYTHON PROGRAMM:
[snip]

> socket.error: (98, 'Address already in use')
>                                                                      
> DOES SOMEONE HAS AN IDEA ?

PLEASE learn to format your questions more appropriately!  Your post is 
simply _awful_ to read.  At the very least, ALL CAPS is considered to be 
"shouting", though I can see why you had to use them since it would have 
been impossible to see the questions amongst all the code.

In any case, assuming I've been able to guess at the specific problem 
based on the above lines, which isn't certain, you need to use a line 
something like this in your code to allow your server socket to bind to 
an address that was previously in use:

server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

For more background, I suggest a Google search on "python so_reuseaddr".

-Peter



More information about the Python-list mailing list