Example #1
0
int
main (int argc, char* argv[])
{
  Communicator* comm = Communicator::instance();
  if (comm->init () == -1)
    return -1;
  
  Endpoint endpoint ("TCP", "", 3000);
  ObjectAdapter* oa = comm->createObjectAdapterWithEndpoint ("MyHello", &endpoint);
  Object* object = new demo::MyHelloI;
  oa->add (object, "MyHello");

  comm->run ();

  return 0;
}
Example #2
0
int
main (int argc, char* argv[])
{
  Communicator* comm = Communicator::instance();
  if (comm->init () == -1)
    return -1;

  demo::DelayResponse* task = new demo::DelayResponse;

  Endpoint endpoint ("TCP", "", 3000);
  ObjectAdapter* oa = comm->createObjectAdapterWithEndpoint ("MyHello", &endpoint);

  demo::AmhMyHelloI*  amh = new demo::AmhMyHelloI;
  amh->set(task);
  oa->add (amh, "MyHello");

  task->activate();

  comm->run ();

  delete task;

  return 0;
}
Example #3
0
int
Subscriber::run(int argc, char* argv[]) {
  Communicator* comm = Communicator::instance();
  if (comm->init (true) == -1)
    return -1;

  Reference ref (comm, Identity("TopicManager"), Endpoint("TCP", "127.0.0.1", 5555));
  IcmProxy::IcmMsg::TopicManager topicManager;
  topicManager.setReference (&ref);

  ObjectAdapter* adapter = comm->createObjectAdapterWithEndpoint("Subscriber", "127.0.0.1 8888");
  IcmProxy::Object* networkProxy = adapter->add(new NetworkI(), "NetworkTopic");

  ::IcmProxy::IcmMsg::Topic* topic = topicManager.retrieve("NetworkTopic");
  if(topic == 0)
	  topic = topicManager.create("NetworkTopic");
  if (topic == 0)
    return -1;
  topic->subscribe(networkProxy);

  comm->run();

  return 0;
}