Re: [Orbit-python-list] are you alive? and the "orbit-python" project?
Status: Inactive
Brought to you by:
tack
From: Eugene P. S. <eu...@en...> - 2002-05-28 23:02:07
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> Hello!<br> <br> Christian Reis wrote:<br> <blockquote type="cite" cite="mid...@bl..."> <pre wrap="">On Tue, May 28, 2002 at 03:18:11PM +0900, Eugene P. Sizikov wrote:<br></pre> <blockquote type="cite"> <pre wrap="">I have a question about using CORBA NamingService with orbit-python <br>(using o-p from gnome cvs). When I do 'import CosNaming' where the <br>CosNaming module imported from? And why it's only NamingService and not <br>InteroperableNamingService as in ORBit2 (no NamingContextExt interface <br>implementation)?<br></pre> </blockquote> <pre wrap=""><!----><br>Well, o-p is based on ORBit 0.5.x, so it doesn't support it. I've<br>attached some sample code that offers an example of a NS client.<br><br>I'm not sure if we can interoperate with an ORBit2 name server, but if<br>we don't, it's a bug.<br><br>Take care,<br>--<br>Christian Reis, Senior Engineer, Async Open Source, Brazil.<br><a class="moz-txt-link-freetext" href="http://async.com.br/~kiko/">http://async.com.br/~kiko/</a> | [+55 16] 272 3330 | NMFL<br></pre> <pre wrap=""><br><hr width="90%" size="4"><br>#!/usr/local/bin/python<br>import socket, signal, sys, os, getopt, string<br><br># Stoq nameserver IOR spitter v0.0 <br># Born 22 Nov 2K <a class="moz-txt-link-abbreviated" href="mailto:ki...@as...">ki...@as...</a><br><br># The DEFAULT_PORT is only used if the rcfile can't be read<br># DEFAULT_HOST is useless, IMO<br><br>DEFAULT_PORT=3733<br>DEFAULT_HOST=""<br>DEBUG=0<br><br>def appkill(signum, frame):<br> print "%s: shutting down" % sys.argv[0]<br> sys.exit()<br><br>signal.signal(signal.SIGTERM,appkill)<br>signal.signal(signal.SIGINT,appkill)<br><br>PORT=DEFAULT_PORT<br>HOST=DEFAULT_HOST<br><br>try:<br> opt, args = getopt.getopt(sys.argv[1:],'p:h', ['help','port='] )<br>except getopt.error, s:<br> print "%s: %s" % (sys.argv[0] , s)<br> sys.exit(1)<br><br>for o in opt:<br><br> if o[0] == "-d" or o[0] == "--debug":<br> DEBUG=1<br><br> if o[0] == "-p" or o[0] == "--port":<br> try:<br> PORT=int(o[1])<br> except Val ueError:<br> print "%s: port number must be integer" % sys.argv[0]<br> sys.exit(1)<br><br> if o[0] == "-h" or o[0] == "--help":<br> print "%s: CORBA Nameserver Wrapper (with TCP-spit IOR)" % sys.argv[0]<br> print "%s: usage: %s [-p port]" % ( sys.argv[0] , sys.argv[0] )<br> sys.exit(1)<br><br>try:<br> s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)<br> # to avoid being stuck with sockets in TIME_WAIT<br> s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)<br> s.bind(HOST,PORT)<br> s.listen(1)<br>except:<br> s.close()<br> print 'Problem with socket creation and bind'<br> print sys.exc_type,sys.exc_value<br> sys.exit(1)<br><br># inverted exception handling here - found is good, default is bad<br><br>try: <br> for f in string.split(os.environ["PATH"],":"):<br> if os.access( "%s/orbit-name-server" % f,os.X_OK):<br> raise "Found"<br> print "%s: orbit-name-server not found in path" % sys.argv[0]<br> sys.exit(1)<br>except "Found":<br> pass<br><br># This is a bit of b lack magic but it works for me: we popen<br># orbit-name-server, read the ior and f.close() it. Now, since this<br># child process is mine, it dies when I sys.exit(), and we're all happy.<br># Looks unlikely to work on Win32, but os.popen doesn't work anyway :-)<br>f=os.popen("orbit-name-server &","r")<br>iorstring=f.readline()<br>f.close()<br><br>if DEBUG:<br> print "IOR is %s" % iorstring<br>if DEBUG:<br> print "%s: started up with port to %s" % ( sys.argv[0] , PORT )<br><br>try:<br> while 1:<br> conn,addr=s.accept()<br> if DEBUG:<br> print 'Peer is',addr<br> conn.send(iorstring)<br> conn.close()<br>except SystemExit:<br> sys.exit(0)<br>except:<br> conn.close()<br> s.close()<br> print 'Foobared'<br> print sys.exc_type,sys.exc_value<br> sys.exit(1)<br><br></pre> </blockquote> I do not understand what is this example must help me with. I have a problem to work with NameService AFTER getting the IOR (and naming_context = orb.string_to_object(ior)). Calling of any method of the "naming_context" fails and leads to client (and server!) aborting... Why?!<br> <br> BTW, what happened with the irc channel #orbit-python on openprojects.net? It's eventually empty...<br> <br> </body> </html> |