why is there now execption for windows? trying to listen twice to the same port

News123 news1234 at free.fr
Sat Mar 20 14:38:43 CET 2010


I'm having a small multiprocessing manager:

# ##########################
import socket,sys
from multiprocessing.managers import BaseManager

mngr = BaseManager(address=('127.0.0.1',8089),authkey='verysecret')
try:
    srvr = mngr.get_server()
except socket.error as e:
    print "probably address already in use"
    sys.exit()
print "serving"
srvr.serve_forever()


Under linux this script can only be run once.
The second call will raise an exception, as the previous program is
already listening to pot 8089.


Under Windows however the program can be started twice.
and will print twice "serving". This surprises me

Howver only one of them will successfully listen and respond to
connections, but I don't get an exception.

Is this to be expected?

I'd like to be sure, that the manager is only started once and that it
can be started anytime it's not up.


N



More information about the Python-list mailing list