I managed to use an event channel over a network using iiop, and it works great using computer A as a supplier and computer B as a consumer, but if I swap the two roles, no longer does consumer (now computer A) receive any data. I turned off all firewalls and can not figure out this error. The programs also work if localhost is used and both run on the same machhine. I have only noticed one difference when trying to debug: when the programs work, 3 sockets get opened, but in the configuration in which the programs don't work, only 2 sockets are opened. I am guessing this extra socket is the event channel because the orbs find each other and properly handle name service operations. Are there any thoughs? Here is relevant code:
#CONSUMER
#omitted checks on objects, but they pass during runtime
my $orb = CORBA::ORB_init(\@ARGV);
my $refs = $orb->list_initial_references();
my $obj = $orb->string_to_object('corbaloc:rir:');
my $nc = CosNaming::NamingContext::_narrow($obj);
## Test the _non_existent operation
if ($nc->_non_existent()) {
print STDERR "It's not there\n";
exit(1);
}
else {
print "It's there\n"; #always prints if server is found, even if event channel fails to work properly
}
my @names = (new CosNaming::NameComponent('eventChannel', ''));
my $obj = $nc->resolve(\@names);
my $eventChannel = CosEventChannelAdmin::EventChannel::_narrow($obj);
my $consumer = new Client();
my $poa = $orb->resolve_initial_references('RootPOA');
my $id = $poa->activate_object($consumer);
my $obj = $poa->id_to_reference($id);
my $connectionobj = CosEventComm::PushConsumer::_narrow($obj);
my $poamanager = $poa->the_POAManager();
$poamanager->activate();
my $admin = $eventChannel->for_consumers();
my $supplier = $admin->obtain_push_supplier();
$supplier->connect_push_consumer($connectionobj);
$orb->run();
$orb->destroy();
#SUPPLIER
my $orb = CORBA::ORB_init(\@ARGV);
my $nc = new NamingContextExt_i($orb);
my $poa = $orb->resolve_initial_references('RootPOA');
my $id = $poa->activate_object($nc);
my $obj = $poa->id_to_reference($id);
my $eventChanneli = new EventChannel_i();
my $eventChanneliID = $poa->activate_object($eventChanneli);
$eventChanneli->init();
my $eventChanneliRef = $poa->id_to_reference($eventChanneliID);
my $eventChannel = CosEventChannelAdmin::EventChannel::_narrow($eventChanneliRef);
my @name = (new CosNaming::NameComponent('eventChannel', ''));
$nc->rebind(\@name, $eventChannel);
my $ior = $orb->object_to_string($obj);
my $iortable = IORTable::Table::_narrow(
$orb->resolve_initial_references('IORTable'));
$iortable->rebind('NameService', $ior) if (defined $iortable);
my $poamanager = $poa->the_POAManager();
$poamanager->activate();
my $supplier = new InsteonSource();
my $id = $poa->activate_object($supplier);
my $obj = $poa->id_to_reference($id);
my $supplierobj = CosEventComm::PushSupplier::_narrow($obj);
my $admin = $eventChannel->for_suppliers();
my $consumer = $admin->obtain_push_consumer();
$consumer->connect_push_supplier($supplierobj);
#PUSH SOME STUFF HERE omitted
$consumer->disconnect_push_consumer();
$eventChannel->destroy();
$orb->shutdown();
$orb->destroy();
PS This is the best perl corba impl I have seen, I just have this hangup.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Computer A is running v5.8.8 built for i486-linux-gnu-thread-multi of perl where
Computer B is running v5.8.8 built for i386-linux-thread-multi of perl.
I am not explicitly setting the OPALORB_MULTI_THREADED environment variable so I am guessing it is disabled.
I call run in the section I called PUSH SOME STUFF HERE, but I only run it for a short period because I can't allow the program to block. The section of code that pushes information is inside of a callback, so when data is available to read, the callback is called and the data is pushed, but the callback can't block because more callbacks need to get called later, so I call $orb->run(1);.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm... I mocked up an InsteonSource module and a Client module and used the code you provided as consumer and supplier and had no issues. What are the command lines you used for the supplier and consumer for all of the different computer configurations?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And it kind of works in the second configuration because all initial communication works, but all communication related to event service doesn't work at all (nothing happens, it is as if it doesn't exist, no exceptions or anything. I looked at network traffic and that socket never gets opened and there is never any event messages such as push, but everything else still goes on, push_consumer...). Let me try to bring my code to an absolute minimum and retry....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you send me a sample code in perl using nameservice for this server client connection. I am new to corba...and I was using only ior file to do the same.Suggest me also what version of perl should I use... I am using v-5.18.2 now..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For anyone stumbling upon this message, through the help of elliott_c2003, I was able to solve this problem by addinig
-ORBListenEndpoints corbaloc...ip-address-of-local-machine:some-port in conjunction with -ORBInitRef... to the consumer.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I managed to use an event channel over a network using iiop, and it works great using computer A as a supplier and computer B as a consumer, but if I swap the two roles, no longer does consumer (now computer A) receive any data. I turned off all firewalls and can not figure out this error. The programs also work if localhost is used and both run on the same machhine. I have only noticed one difference when trying to debug: when the programs work, 3 sockets get opened, but in the configuration in which the programs don't work, only 2 sockets are opened. I am guessing this extra socket is the event channel because the orbs find each other and properly handle name service operations. Are there any thoughs? Here is relevant code:
#CONSUMER
#omitted checks on objects, but they pass during runtime
my $orb = CORBA::ORB_init(\@ARGV);
my $refs = $orb->list_initial_references();
my $obj = $orb->string_to_object('corbaloc:rir:');
my $nc = CosNaming::NamingContext::_narrow($obj);
## Test the _non_existent operation
if ($nc->_non_existent()) {
print STDERR "It's not there\n";
exit(1);
}
else {
print "It's there\n"; #always prints if server is found, even if event channel fails to work properly
}
my @names = (new CosNaming::NameComponent('eventChannel', ''));
my $obj = $nc->resolve(\@names);
my $eventChannel = CosEventChannelAdmin::EventChannel::_narrow($obj);
my $consumer = new Client();
my $poa = $orb->resolve_initial_references('RootPOA');
my $id = $poa->activate_object($consumer);
my $obj = $poa->id_to_reference($id);
my $connectionobj = CosEventComm::PushConsumer::_narrow($obj);
my $poamanager = $poa->the_POAManager();
$poamanager->activate();
my $admin = $eventChannel->for_consumers();
my $supplier = $admin->obtain_push_supplier();
$supplier->connect_push_consumer($connectionobj);
$orb->run();
$orb->destroy();
#SUPPLIER
my $orb = CORBA::ORB_init(\@ARGV);
my $nc = new NamingContextExt_i($orb);
my $poa = $orb->resolve_initial_references('RootPOA');
my $id = $poa->activate_object($nc);
my $obj = $poa->id_to_reference($id);
my $eventChanneli = new EventChannel_i();
my $eventChanneliID = $poa->activate_object($eventChanneli);
$eventChanneli->init();
my $eventChanneliRef = $poa->id_to_reference($eventChanneliID);
my $eventChannel = CosEventChannelAdmin::EventChannel::_narrow($eventChanneliRef);
my @name = (new CosNaming::NameComponent('eventChannel', ''));
$nc->rebind(\@name, $eventChannel);
my $ior = $orb->object_to_string($obj);
my $iortable = IORTable::Table::_narrow(
$orb->resolve_initial_references('IORTable'));
$iortable->rebind('NameService', $ior) if (defined $iortable);
my $poamanager = $poa->the_POAManager();
$poamanager->activate();
my $supplier = new InsteonSource();
my $id = $poa->activate_object($supplier);
my $obj = $poa->id_to_reference($id);
my $supplierobj = CosEventComm::PushSupplier::_narrow($obj);
my $admin = $eventChannel->for_suppliers();
my $consumer = $admin->obtain_push_consumer();
$consumer->connect_push_supplier($supplierobj);
#PUSH SOME STUFF HERE omitted
$consumer->disconnect_push_consumer();
$eventChannel->destroy();
$orb->shutdown();
$orb->destroy();
PS This is the best perl corba impl I have seen, I just have this hangup.
What are the Perl versions and opalORB version(s) on computer A and computer B? Also, are you setting the OPALORB_MULTI_THREADED environment variable?
Also, are you running the ORB event loop in your supplier?
Thanks,
Chad
Computer A is running v5.8.8 built for i486-linux-gnu-thread-multi of perl where
Computer B is running v5.8.8 built for i386-linux-thread-multi of perl.
I am not explicitly setting the OPALORB_MULTI_THREADED environment variable so I am guessing it is disabled.
I call run in the section I called PUSH SOME STUFF HERE, but I only run it for a short period because I can't allow the program to block. The section of code that pushes information is inside of a callback, so when data is available to read, the callback is called and the data is pushed, but the callback can't block because more callbacks need to get called later, so I call $orb->run(1);.
Hmm... I mocked up an InsteonSource module and a Client module and used the code you provided as consumer and supplier and had no issues. What are the command lines you used for the supplier and consumer for all of the different computer configurations?
Sorry, and both are running version 0.0103 (0.1.3)
Computer A: perl supplier.pl -ORBListenEndpoints corbaloc:iiop:ip-address-of-comp-a:1234
Computer B: perl consumer.pl -ORBInitRef NameService=corbaloc:iiop:ip-address-of-comp-a:1234/NameService
it works though if I swap the roles:
Computer B: perl supplier.pl -ORBListenEndpoints corbaloc:iiop:ip-address-of-comp-b:1234
Computer A: perl consumer.pl -ORBInitRef NameService=corbaloc:iiop:ip-address-of-comp-b:1234/NameService
And it kind of works in the second configuration because all initial communication works, but all communication related to event service doesn't work at all (nothing happens, it is as if it doesn't exist, no exceptions or anything. I looked at network traffic and that socket never gets opened and there is never any event messages such as push, but everything else still goes on, push_consumer...). Let me try to bring my code to an absolute minimum and retry....
I can also send you my test if you'd like. If it works, you might be able to compare it and see what's different.
Yes please, that would be nice:
chrismiceli at excite dot com
Can you send me a sample code in perl using nameservice for this server client connection. I am new to corba...and I was using only ior file to do the same.Suggest me also what version of perl should I use... I am using v-5.18.2 now..
For anyone stumbling upon this message, through the help of elliott_c2003, I was able to solve this problem by addinig
-ORBListenEndpoints corbaloc...ip-address-of-local-machine:some-port in conjunction with -ORBInitRef... to the consumer.