what is the correct way to close a socket in python 2.6?
Posted
by davidshen84
on Stack Overflow
See other posts from Stack Overflow
or by davidshen84
Published on 2010-05-04T12:22:07Z
Indexed on
2010/05/04
12:28 UTC
Read the original article
Hit count: 184
hi,
i have a simple server/client. and i am using the netcat as the client to test the server. if i stop the server before the client exit, i will not be able to start the server again for a while and i go this error: " [Errno 98] Address already in use "
but if i close the client first, then the server stops, i will not have this issue.
my server socket works like this:
try:
s=socket
s.bind(..)
s.listen(1)
conn,addr=s.accept()
finally:
conn.close()
s.close()
it feels to me that the server did not close the socket properly. but i do not know how to fix this.
© Stack Overflow or respective owner