I think your problem /may/ be in the following line of code: sa.listen(1) I believe what's happening is that the listen() creates a decremental counter of the number of connections to accept. Once it decrements to 0, it won't accept any more connections. (I'm not at all sure, but that sounds like what it's doing.)
One thing that I have noted is that once I am done with some internet program, the connection that program created is left in the waiting state. This might explain why, when you close your application and open it back up again a short amount of time later, the connection is refused. Another thought on this matter is that your end may be closing the connection, but the daemon end might not be closing the connection, so the listen counter may not increment back up to say "Hey, I'm available for another connection." Nevertheless, I'm also relatively new to Sockets, so my guess is probably just as good as your guess. :P (Hell, I couldn't get them fully right away, and read that it was easier to use asyncore.dispatcher for a daemon, so I'm using that!) If you find out the problem, please post it up here for all to learn from :) Oh, and just a suggestion, do something like a 'netstat -a -p --inet' on the daemon end. (Might not be the completely correct command =\) Hope that helps -Wes -- http://mail.python.org/mailman/listinfo/python-list