Putting the server into a loop to service requests

Why and when to perform this task

Use this task to add code to the source file for a CORBA server and cause the server to enter its request loop. This allows the server to respond to requests received from clients.

To cause the server to enter its request loop, edit the server source file, servantServer.cpp, and add the following code to the main() function:

int main( int argc, char *argv[] )
{
   .
   . initialization code
   .

   .
   . create and bind the servant object
   .


   .
   . Create the shutdown object
   .

   // Enter the request loop.
   cout << "Server is ready for e-business..." << endl;
   ::CORBA::Status stat = boaPtr->execute_request_loop ( ::CORBA::BOA::SOMD_WAIT );

   // Terminate the server.
   cout << "Server is now shutting down..." << endl;
   .
   .
   .
   
   return 0;
}

Results

This task adds code that causes the CORBA server to enter its request-processing loop. During this loop, the server can service incoming requests for the servant object or objects that it hosts.

What to do next

Add code to the server source file to enable the server to complete the server shut down when requested as described in Adding code to shutdown the server and release resources used.

Related tasks
Creating the CORBA server main code (server.cpp)
Shutting down the server and releasing resources used



Searchable topic ID:   tcor_pgms5g
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/tasks/tcor_pgms5g.html

Library | Support | Terms of Use | Feedback