From: Eric C. N. <eri...@us...> - 2002-05-09 14:16:21
|
Update of /cvsroot/recall/corba/src In directory usw-pr-cvs1:/tmp/cvs-serv29776 Modified Files: server.py Log Message: more fixups for publishing IOR on a socket Index: server.py =================================================================== RCS file: /cvsroot/recall/corba/src/server.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** server.py 7 May 2002 12:46:41 -0000 1.17 --- server.py 9 May 2002 14:16:18 -0000 1.18 *************** *** 22,49 **** return self.ctor(echo) - def listen(host, port): - import socket - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - bound = None - for unused in range(241): # TIME_WAIT may be as long as 240 secs - try: - if not bound: - s.bind( (host, port) ) - bound = 1 - s.listen(1) - return s - except socket.error, exc: - Log.error(str(exc)) - time.sleep(1) - raise socket.error('Cannot listen on socket %s:%d' % (host, port)) - - def publisher(host, port, ior): - s = listen(host, port) - while 1: - c, a = s.accept() - c.send(ior) - c.close() - def main(): if sys.argv < 4: --- 22,25 ---- *************** *** 72,78 **** c.activatePOA() ! ! import thread ! thread.start_new_thread(publisher, (host, port, c.object_to_string(server))) try: --- 48,52 ---- c.activatePOA() ! c.publish('', port, server) try: |