![]() |
|
Use this task to add code to the source file for a CORBA server, to put the server into an infinite loop during which the ORB can transmit requests to and from the servant object hosted by the server.
This task is one step of the parent task to create the CORBA server main code, as described in Creating a CORBA server main code (server.cpp).
To add code to put the server into an infinite loop, edit the server source file, servantServer.cpp, and add the following code:
void main( int argc, char *argv[] ) { ... // Initialize this application as a server, ... try { bp->impl_is_ready( imp, 0 ); } ... cout << "Created ServerShutdown object" << endl; cout << endl; cout << "server listening...." << endl << endl; cout.flush(); // Go into an infinite loop, servicing ORB requests as they are // received. execute_request_loop() will return when an external command, // StopServer, is executed. stat = bp-<;gt;execute_request_loop( ::CORBA::BOA::SOMD_WAIT ); cout << "execute_request_loop has returned!" << endl; // Terminate the server. ... }
This task adds code that puts a CORBA server into a loop during which it can service requests for the servant object that it hosts.
You need to add code to the server source file to enable the server to complete the server shutdown when requested, as described in Creating CORBA server main code (server.cpp), adding code to shutdown the server and release resources used.
![]() |