Discussion:
[omniORB] help..............................
l l
2008-01-04 13:23:16 UTC
Permalink
help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:
i am using omniORB4.1.1 under msvc++6.0 + sp6,i test the example(echo),client execute hello fuction succefully ,when client exit ,then server display the exception below,but server does not exit and run continue:
First-chance exception in TestCorba.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
my program is below:
*********server***********
char* Echo_i::echoString(const char* mesg)
{
char RetStr[256];
strcpy(RetStr,mesg);
strcat(RetStr,"--from Server");
//return RetStr;
return CORBA::string_dup(RetStr);
}
int main(int argc, char** argv)
const char* options[][2] = { { "endPoint", "giop:tcp::1234" },{ 0, 0 } };
try
{
CORBA::ORB_var orb = CORBA::ORB_init(argc,
argv,"omniORB4",options);//,options
CORBA::Object_var obj = orb->resolve_initial_references("omniINSPOA");//RootPOA
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
Echo_i* myecho = new Echo_i();
PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId("EchoService");
poa->activate_object_with_id(oid, myecho);
obj = myecho->_this();
CORBA::String_var sior(orb->object_to_string(obj));
cerr << "" << (char*)sior << "" << endl;
myecho->_remove_ref();
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
orb->run();
}
catch(CORBA::SystemException&)
{
cerr << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&)
{
cerr << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
cerr << "Caught omniORB::fatalException:" << endl;
cerr << " file: " << fe.file() << endl;
cerr << " line: " << fe.line() << endl;
cerr << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
cerr << "Caught unknown exception." << endl;
}
return 0;
}

****client**********
int main(int argc, char** argv)
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv,"omniORB4");
CORBA::Object_var obj = orb->string_to_object ("corbaloc:iiop:172.20.56.141:1234/EchoService");
Echo_var echoref = Echo::_narrow(obj);
if( CORBA::is_nil(echoref) )
{
cerr << "Can't narrow reference to type Echo (or it was nil)." << endl;
return 1;
}

// for (CORBA::ULong count=0; count<10; count++)
hello(echoref);
orb->destroy();
}
catch(CORBA::TRANSIENT&) {
cerr << "Caught system exception TRANSIENT -- unable to contact the "
<< "server." << endl;
}
catch(CORBA::SystemException& ex) {
cerr << "Caught a CORBA::" << ex._name() << endl;
}
catch(CORBA::Exception& ex) {
cerr << "Caught CORBA::Exception: " << ex._name() << endl;
}
catch(omniORB::fatalException& fe) {
cerr << "Caught omniORB::fatalException:" << endl;
cerr << " file: " << fe.file() << endl;
cerr << " line: " << fe.line() << endl;
cerr << " mesg: " << fe.errmsg() << endl;
}
return 0;
}


---------------------------------
ÑÅ»¢ÓÊÏ䎫µÝÐÂÄê×£ž££¬žöÐԺؿšËÍÇ×Åó£¡
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080104/d472d7b2/attachment.htm
Loading...