A
AK
Hi, I'm trying to make a little mp3 server / client and I'm running into
a problem with the Socket error 98 "Address already in use". The error
doesn't happen right away, I can send 3-4 commands, disconnecting and
reconnecting and they work fine and then I get this error and the client
can no longer connect, although the client side doesn't get any errors.
Here's the relevant code:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
try: self.player(conn, addr)
except: pass
conn.close()
s.close()
del s
... and on client:
HOST = ''
PORT = 50025
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.connect((HOST, PORT))
Thanks! -ak
a problem with the Socket error 98 "Address already in use". The error
doesn't happen right away, I can send 3-4 commands, disconnecting and
reconnecting and they work fine and then I get this error and the client
can no longer connect, although the client side doesn't get any errors.
Here's the relevant code:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
try: self.player(conn, addr)
except: pass
conn.close()
s.close()
del s
... and on client:
HOST = ''
PORT = 50025
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.connect((HOST, PORT))
Thanks! -ak