[tao-users] Rebinding CORBA object reference
Chao Wang 王超
cswang198675 at gmail.com
Mon Jun 4 11:11:41 CDT 2018
Hi Milan,
Per your comment in the catch block, I had a related issue and I solved it
using the IORTable service (
http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/TAO/docs/INS.html ). Hope
the following sample would be helpful. I attached some explanation at the
end:
// on the server side
#include "tao/IORTable/IORTable.h"
...
CORBA::Object_var table_object =
orb->resolve_initial_references ("IORTable");
IORTable::Table_var ior_table =
IORTable::Table::_narrow (table_object.in ());
if (CORBA::is_nil (ior_table.in ()))
{
cerr << "Nil IORTable" << endl;
}
else
{
// In my case, I use the event channel; substitute the argument by what
you needed
CORBA::String_var ior = orb->object_to_string(event_channel.in());
ior_table->bind ("YourObjKey", ior.in());
}
Then run the service with option "ORBListenEndpoints" like the following:
./Service -ORBListenEndpoints iiop://YourServerHostname:portNumber
and then on the client side run with option "ORBInitRef" like the
following, and it will work:
./Client -ORBInitRef
YourObjKey=corbaloc:iiop:YourServerHostname:portNumber/YourObjKey
Explanation:
The server uses IORTable to maintain object references to certain object
keys.
ORBListenEndpoints declares contact point(s) for accessing the IORTable.
ORBInitRef directs the client program to the right contact point.
In this way, no need to pass around IORs.
Hope that helps,
Chao
2018-05-31 11:53 GMT-05:00 Milan Cvetkovic <milan.cvetkovic at mpathix.com>:
> PRF:
>
> TAO VERSION: 2.3.3
> ACE VERSION: 6.3.3
>
> HOST MACHINE and OPERATING SYSTEM: Linux Debian 8 on amd64
> THE $ACE_ROOT/ace/config.h FILE: config-linux.h
>
> THE $ACE_ROOT/include/makeinclude/platform_macros.GNU:
> platform_linux.GNU
>
> SYNOPSIS:
>
> Is there a way to force rebinding of a valid reference to a corba object:
>
> DESCRIPTION:
>
> Client application is experiencing timeouts after extended inactivity.
> Client and server are in different networks, connected through NAT. I
> would like to force the client to rebind (close TCP connection, and
> reconnect) on CORBA::TIMEOUT:
>
> Sample:
>
> CORBA::Object_var o = orb->string_to_object ("corbaloc:...");
> MyObject_var mo = MyObject::_narrow (o.in());
> mo->op ();
> ACE_OS::sleep (3600);
>
> try
> {
> mo->op();
> }
> catch (CORBA::TIMEOUT&)
> {
> // here I would like to close the existing transport,
> // and force reconnect.
> #if 0
> // this would work, but requires me to keep copies of orb and IOR
> // reference around
> o = orb->string_to_object ("corbaloc:...");
> mo = MyObject::_narrow (o.in());
> #endif
> }
>
> Thanks, Milan
> _______________________________________________
> tao-users mailing list
> tao-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/tao-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/tao-users/attachments/20180604/99bf962e/attachment.html>
More information about the tao-users
mailing list