socket.error: [Errno 98] Address already in use

Thomas Jollans thomas at jollybox.de
Wed Sep 15 14:49:04 EDT 2010


On Wednesday 15 September 2010, it occurred to cerr to exclaim:
> Hi There,
> 
> I get a socket error "[Errno 98] Address already in use" when i try to
> open a socket that got closed before with close(). How come close()
> doesn't close the socket properly?
> My socket code :
> 
>   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>   s.bind((host, port))
>   s.listen(1)
> ...
> ...
> ...
>   while loop:
>     conn, addr = s.accept()
>     while conn and loop:
> ...
> ...
> ...
> 	  conn.close()
> 
> Shouldn't that clean it all up properly?

`s` is still listening?



More information about the Python-list mailing list