closing a socket
Keith Murphy
kpmurphy at my-deja.com
Fri Jul 21 10:45:13 EDT 2000
william and co,
so what does that line do? does it force a socket connection closed or
are you able to do that? here's the problem. the server goes down, and
it closes all of its connections, but a client is still running. when
the server tries to restart, it can't because the socket is in use.
does that magic line below fix this? thanks!
-->keith
In article <jt8zuw7pqj.fsf at wazor.biostat.wisc.edu>,
William Annis <annis at biostat.wisc.edu> wrote:
>
> Keith Murphy <kpmurphy at my-deja.com> writes:
>
> > is closing sockets tricky? or am i doing something wrong...
shouldn't
> > this work?
>
> There is one small thing you need, something every sockets
> beginner misses at first. I know I did...
>
> > s = socket(AF_INET, SOCK_STREAM)
>
> You need the set the 'reuse address' option:
>
> s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
>
> > however, i get the following error if i try and run it a second
time:
> >
> > socket.error: (125, 'Address already in use')
>
> --
> William Annis - System Administrator - Biomedical Computing Group
> annis at biostat.wisc.edu PGP ID:1024/FBF64031
> Mi parolas Esperanton - La Internacian Lingvon www.esperanto.org
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list