corba: unable to connect to server

324 views Asked by At

I am trying to connect to server but unable to do so. Below is the code snippet, the server is running on 3.204.24.98:6090.

char* ior = "corbaloc:iiop:3.204.24.98:6090";

cout<<"controllers ior : "<<ior;

//CORBA::Object_var obj = orb -> string_to_object(ior);
Hello_var hello = Hello::_narrow(orb->string_to_object(ior));

Is there anything extra that I am missing here. Any suggestions will be of great help.

Thanks

1

There are 1 answers

0
Johnny Willemsen On

You miss the object key which tells the ORB which object in the server you want to reach. Check the IORTable support, with that your server can make the object available using a simple name which the client can use. With C++11 this would be in the server code

  std::string ior = orb->object_to_string (server_reference);
  auto ior_table_obj = orb->resolve_initial_references("IORTable");
  auto tmp = IDL::traits<IORTable::Table>::narrow (ior_table_obj);
  ior_table->bind("Hello", ior);

The client can then use

  auto tmp = orb->string_to_object("corbaloc:iiop:3.204.24.98:6090/Hello");
  auto hello = IDL::traits<Test::Hello>::narrow (tmp);