TipcConnMainLoop


Name

TipcConnMainLoop — read and process messages on a connection

Synopsis

T_BOOL TipcConnMainLoop(conn, timeout) 
T_IPC_CONN conn; 
T_REAL8 timeout; 

Arguments

conn — connection to read and process messages on

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

Return Values

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

Diagnostics

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

Description

TipcConnMainLoop reads and processes messages on a connection. TipcConnMainLoop is a convenience function that keeps calling TipcConnMsgNext with the time remaining from timeout until TipcConnMsgNext returns FALSE. For each message that TipcConnMainLoop gets, it processes the message with TipcConnMsgProcess and then destroys the message with TipcMsgDestroy. Use 0.0 for timeout to poll the connection and catch up on all pending messages that have accumulated. Use T_TIMEOUT_FOREVER for timeout to read and process messages indefinitely.

As soon as TipcConnMsgNext returns FALSE, TipcConnMainLoop returns. If TipcConnMsgNext sets the global SmartSockets error number to T_ERR_TIMEOUT_REACHED (the timeout period was reached) or T_ERR_WOULD_BLOCK (the connection is in non-blocking mode with timeouts disabled), then TipcConnMainLoop returns TRUE; otherwise it returns FALSE. See TipcConnRead for more information on these error numbers.

Caution

None

See Also

TipcConnMsgNext, TipcConnMsgProcess

Examples

This example does a time-consuming calculation, then catches up on its messages with TipcConnMainLoop:

perform_lengthy_calculation(); 
 
if (!TipcConnMainLoop(conn, 0.0)) { 
  return;  /* error */ 
}  

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