Sockets

Doug Fort dougfort at downright.com
Thu Jun 14 06:55:28 EDT 2001


mixo wrote:

> I create a socket and listen for connections  in try and , close  socket
> 
> in a except. Also, within the try I have a while loop that I create a
> socket
> once a connection has been made to a client., and close the socket once
> data has been sent to a client. Now, my problem is, if at least  one
> connection is made, when the server dies, I can't restart it as I
> can't create a new socket for the server.. Is there something
> that hapens when a connection is accepted that prevents a restart
> of the server?
> 
> P.S I am using the socket module.
> 
> 
Try using something like:
self.socket.setsockopt(socket.SOL_SOCKET, socket.S_REUSEADDR, 1)

Note:  This code was lifted from the SocketServer.py library module.  It's 
worth reading that module in detail if you're going to use sockets.
-- 
Doug Fort <dougfort at downright.com>
Senior Meat Manager
Downright Software LLC
http://www.downright.com

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With Seven Servers In California And Texas - The Worlds Uncensored News Source
  



More information about the Python-list mailing list