OMOSSocket class

The OMOSSocket class represents the socket through which data is passed between Rational® Rhapsody® and an instrumented application.

OMOSSocket is generally used for animation, but it can also be used for other connections, as long as you provide a host name and port number. OMOSSocket represents the client side of the connection, and assumes that somewhere over the network there is a server listening to the connection. You can modify the definition of the OMOSSocket class to remove the _OMINSTRUMENT macro definition from the relevant places to provide a socket implementation for non-instrumented configurations. In addition, you might need to modify the definition of the SOCK_LIB macro inside the MakeFileContent property to be similar to that for tracing and animation.

If an animation session appears to hang, it might be because the high volume of messages passed between Rational Rhapsody and the application causes the socket's internal buffer to fill up, which might cause a major delay in communication between Rational Rhapsody and the application. The solution to this problem is to increase the size of the socket internal buffer, which is 8K by default. For example, in the Windows NT implementation, you can add the following code to the Create() function for NTSocket:

int NTSocket::Create(
   const char* SocketAddress /*= NULL*/, 
   unsigned int nSocketPort /*= 0*/)
   {
      ... 
      if ((theSock = socket(AF_INET, SOCK_STREAM, proto))
       == INVALID_SOCKET) 
      {
         NOTIFY_TO_ERROR("Could not create socket\n");
         theSock = 0;
         return 0;
      } 
      int internalBufferSizes = 64 * 1024; // 64k
      setsockopt(theSock, SOL_SOCKET, SO_RCVBUF,
         (char*) &internalBufferSizes, sizeof(int));
      setsockopt(theSock, SOL_SOCKET, SO_SNDBUF,
         (char*) &internalBufferSizes, sizeof(int));
      ... 
   }
Note: This solution has been checked for Windows NT systems only.
Construction summary
~OMOSSocket
Destroys the OMOSSocket object
Method summary
Close
Closes the socket
Create
Creates a new socket
Receive
Receives data through the socket
Send
Sends data through the socket

Feedback