socket.error: [Errno 98] Address already in use
cerr
ron.eggler at gmail.com
Thu Sep 16 12:43:45 EDT 2010
On Sep 15, 11:58 am, Grant Edwards <inva... at invalid.invalid> wrote:
> On 2010-09-15, cerr <ron.egg... at gmail.com> wrote:
>
>
>
>
>
> > 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()
>
> At what line does the error occur?
The whole message I get looks like:
Traceback (most recent call last):
File "./checkGPIO.py", line 148, in <module>
main()
File "./checkGPIO.py", line 75, in main
s.bind((host, port))
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
Where line 75 contains following:
s.bind((host, port))
>
> To what does the phrase "open a socket" refer?
create a listening socket...?
> Have you tried the usual solution of setting the SO_REUSEADDR option
> on the socket before calling bind?
yep, that did it for me, thanks a lot! :)
> http://www.google.com/search?q=socket+%27address+already+in+use%27
Google's your friend if you can read ;)
>
> --
> Grant Edwards grant.b.edwards Yow! I own seven-eighths of
> at all the artists in downtown
> gmail.com Burbank!
More information about the Python-list
mailing list