TipcSrvConnMainLoop


Name

TipcSrvConnMainLoop — read and process messages on the connection

Synopsis

T_BOOL TipcSrvConnMainLoop(srv, timeout) 
T_IPC_SRV srv; 
T_REAL8 timeout; 

Arguments

srv — connection handle to RTserver

timeout — maximum number of seconds to wait for message to arrive

Return Values

TRUE if all pending messages were successfully processed on the connection to RTserver, FALSE otherwise.

Diagnostics

If TipcSrvConnMainLoop fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcSrvConnMainLoop reads and processes messages on the connection to RTserver by calling TipcConnMainLoop. TipcSrvConnMainLoop is a convenience function that can be used in many situations instead of TipcSrvConnMsgNext, TipcSrvConnMsgProcess, and TipcMsgDestroy. See TipcConnMainLoop for more information on reading and processing messages.

If an error occurs, TipcSrvConnMainLoop by default restarts RTserver and returns FALSE. To use TipcSrvConnMainLoop with a timeout of T_TIMEOUT_FOREVER, wrap an extra forever loop, either for (;;) or while (1), around the call to TipcSrvConnMainLoop.

TipcSrvConnMainLoop may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, TipcSrvConnMainLoop processes messages on the warm connection. See TipcSrvConnOpen for more information on automatic creation of connections and warm connections to RTserver.

Caution

None

See Also

TipcConnMainLoop, TipcMsgDestroy, TipcSrvConnMsgNext, TipcSrvConnMsgProcess

Examples

This example creates a connection to RTserver, then reads and processes messages forever with TipcSrvConnMainLoop (note the use of TipcSrvConnMainLoop in a loop):

if (!TipcSrvConnOpen(srv, T_IPC_SRV_CONN_FULL)) { 
  return;  /* error */ 
}  
 
for (;;) { 
  if (!TipcSrvConnMainLoop(srv, T_TIMEOUT_FOREVER)) { 
    return;  /* error */ 
  }  
} 

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com