On 06/17/2010 08:19 PM, Grant Edwards wrote: > On 2010-06-17, AK <a...@nothere.com> wrote: >> 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 > > Always, always, always: post the traceback.
Here it is: Traceback (most recent call last): File "./vimp3_player.py", line 112, in <module> Player().main() File "./vimp3_player.py", line 35, in main self.listen() File "./vimp3_player.py", line 41, in listen s.bind((HOST, PORT)) File "<string>", line 1, in bind socket.error: [Errno 98] Address already in use > > If that's your server code, I don't see how you can disconnect and > reconnect. That code only accepts a single connection, then it's done. It's in a while 1: loop. self.player() just takes in a single command and then returns. > > Also always: post minim but real code the shows the problem. It'd be a bit difficult to separate it, I was hoping this is a known issue and this description would be enough, but if that turns out not to be the case I'll make a minimal working example. Thanks for the reply! -ak -- http://mail.python.org/mailman/listinfo/python-list