[omniORB] connecting a servant without IOR parameter (just IPaddress and TCP port) ?

Alberto Casado Martín alberto.casado.martin at gmail.com
Tue Feb 16 17:00:47 GMT 2010


Hi

#!/usr/bin/env python

import sys, os
import CORBA, PortableServer
import Fortune, Fortune__POA

FORTUNE_PATH = "/usr/games/fortune"

class CookieServer_i (Fortune__POA.CookieServer):
    def get_cookie(self):
        pipe   = os.popen(FORTUNE_PATH)
        cookie = pipe.read()
        if pipe.close():
            # An error occurred with the pipe
            raise Fortune.Failure("popen of fortune failed")
        return cookie

# By default, listen on port 2809, the default corbaloc port, so
# clients can access the object with corbaloc::host.name/fortune
if "-ORBendPoint" not in sys.argv:
    sys.argv.extend(["-ORBendPoint", "giop:tcp::2809"])

orb = CORBA.ORB_init(sys.argv)
poa = orb.resolve_initial_references("omniINSPOA")

servant = CookieServer_i()
poa.activate_object_with_id("fortune", servant)

poa._get_the_POAManager().activate()
orb.run()


Maybe i don't understand you but 2809 seems pretty much a specific port..



2010/2/16 DESCOMBES Thierry <descombes at lpsc.in2p3.fr>

> This solution is not acceptable for my application: I need to use a
> specific TCP port (and only one)...
> It should be possible to "force the object key", on the servant side,
> (before or after instantiation) no ? It would be "cross-orb" capable, and
> smarter...
>
> Thanks
>
>
> Thomas Zumbiehl a écrit :
>
>  Or there's another way, avoiding the use of those and being cross-orb
>> capable :
>> You juste need to stringify the top servant's IOR, create a socket on the
>> server within a separate thread before entering the ORB's run method (which
>> is blocking). That thread should wait for connections, send the stringified
>> IOR, close the socket and get back on waiting.
>> That work for me fine for several years now, with both java and C++
>> clients.
>>
>> This avoids you from implementing a name service. The only things the
>> clients should now is the name ou address and port number of the server.
>>
>> Thomas Zumbiehl
>> CTO
>> BV Associates
>> http://www.bvassociates.fr
>>
>> -----Message d'origine-----
>> De : omniorb-list-bounces at omniorb-support.com [mailto:
>> omniorb-list-bounces at omniorb-support.com] De la part de Martin B.
>> Envoyé : mardi 16 février 2010 16:16
>> À : OmniORB Support
>> Objet : Re: [omniORB] connecting a servant without IOR parameter (just
>> IPaddress and TCP port) ?
>>
>> DESCOMBES Thierry wrote:
>>
>>
>>> Hello,
>>> Quite all is in the mail subject... I need to develop a network
>>> application client/server "easy to deploy".
>>> Is it easily possible to develop such an application with the omniORB
>>> API, which can connect a servant directly, just using an IP adress and a TCP
>>> port (and maybe some others static informations...) ?
>>>
>>>
>>
>> Check the docs (and mailing list archives) for "corbaname" and "corbaloc".
>>
>> br,
>> Martin
>>
>>
>>
>> _______________________________________________
>> omniORB-list mailing list
>> omniORB-list at omniorb-support.com
>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>>
>> _______________________________________________
>> omniORB-list mailing list
>> omniORB-list at omniorb-support.com
>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>>
>>
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>



-- 
Alberto Casado.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20100216/f9be19e4/attachment-0001.htm


More information about the omniORB-list mailing list