#include #include "benchC.h" #include "orbsvcs/CosNamingC.h" #include #include #include "cpx.h" //benchmark::Put_var put; benchmark::PutHigh_var highPut; CPX cpx; void sigproc(int signo) { signal(SIGRTMIN+29, sigproc); // int i1 = cpx.get(1); // int i2 /*= cpx.get(2)*/; // int i3 /*= cpx.get(3)*/; // put->allPorts(i1, i2, i3); highPut->onePort(1, cpx.get(1)); // put->allPorts(cpx.get(1), -1, -1); // put->onePort(3, cpx.get(3)); } int main(int argc, char* argv[]){ struct sched_param schedparam; schedparam.sched_priority = 99; if (sched_setscheduler(0, SCHED_FIFO, &schedparam) != 0) { fprintf(stderr, "%s: PID %d: sched_setscheduler() failed errno = %d\n", __FUNCTION__, getpid(), errno); } try{ // initialize ORB CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "Client2ORB"); std::cout<<"ORB ok"<resolve_initial_references("RTORB"); RTCORBA::RTORB_var rtORB = RTCORBA::RTORB::_narrow(rtorb.in()); std::cout<<"RTORB ok"<create_tcp_protocol_properties( sendBufferSize, recvBufferSize, keepAlive, dontRoute, noDelay, RTCORBA::maxPriority /*network priority*/); tcpProperties->enable_network_priority(1); RTCORBA::ProtocolList protocols; protocols.length(1); protocols[0].protocol_type = 0; //TAO_TAG_IIOP_PROFILE; protocols[0].transport_protocol_properties = RTCORBA::ProtocolProperties::_duplicate(tcpProperties.in()); // NamingService CORBA::Object_var namingObject = orb->resolve_initial_references("NameService"); CosNaming::NamingContext_var namingContext = CosNaming::NamingContext::_narrow(namingObject.in()); std::cout<<"NamingService ok"<resolve(name); // put = benchmark::Put::_narrow(benchObj.in()); name[0].id = CORBA::string_dup("HighReceiver"); CORBA::Object_var lowBenchObj = namingContext->resolve(name); highPut = benchmark::PutHigh::_narrow(lowBenchObj.in()); std::cout<<"TransferOjekt ok"<create_private_connection_policy(); pcPolicy[1] = rtORB->create_client_protocol_policy(protocols); CORBA::Object_var newTran = highPut->_set_policy_overrides(pcPolicy, CORBA::SET_OVERRIDE); highPut = benchmark::PutHigh::_narrow(newTran.in()); highPut = benchmark::PutHigh::_narrow(newTran.in()); std::cout<<"PrivateConnection, RTProtocol ok"<resolve_initial_references("RTCurrent"); //RTCORBA::Current_var rtCurrent = RTCORBA::Current::_narrow(rtCurrentObj.in()); //rtCurrent->the_priority(RTCORBA::maxPriority); //std::cout<<"PriorityChange ok"<_validate_connection(inconsistentPolicies.out()); //std::cout<<"explicit bind ok"<connect(); //lowPut->connect(); highPut->allPorts(0, 0, 0); sleep(1); highPut->onePort(1, 255); sleep(1); highPut->allPorts(0, 0, 0); // signal handling signal(SIGRTMIN+29, sigproc); while(true){ pause(); } // destroy ORB orb->destroy(); }catch(CORBA::Exception &any){ std::cout<<"Exception occured: "<