TipcSrvConnMsgNext


Name

TipcSrvConnMsgNext — retrieve the next message from the connection

Synopsis

T_IPC_MSG TipcSrvConnMsgNext(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

A message if successful, NULL otherwise.

Diagnostics

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

Description

TipcSrvConnMsgNext gets the next message from the connection to RTserver by calling TipcConnMsgNext. A connection has a priority queue of incoming messages. See TipcConnMsgNext for more information on getting messages from a connection’s message queue.

TipcSrvConnMsgNext may attempt to automatically create a connection to RTserver. If RTclient has a warm connection to RTserver, and if a message is immediately available, TipcSrvConnMsgNext gets the next message from the warm connection. If no messages are queued in the warm connection, then TipcSrvConnMsgNext calls TutSleep with timeout, so that RTclient does not use an abnormal amount of CPU time. See TipcSrvConnOpen for more information on automatic creation of connections and warm connections to RTserver.

Caution

Call TipcMsgDestroy to destroy the message returned by TipcSrvConnMsgNext when it is no longer needed, unless the message is passed to another function which takes responsibility for destroying the message (such as TipcSrvConnMsgInsert).

RTclients that receive messages with TipcSrvConnMsgNext or TipcSrvConnMsgSearch but do not call TipcSrvConnMsgProcess on those message are not monitorable with the TipcSrvMon* API or RTmon. RTclient monitoring is implemented using connection process callbacks, which are all called by TipcSrvConnMsgProcess.

See Also

TipcConnMsgNext, TipcSrvConnMsgProcess, TipcSrvConnMainLoop, TipcSrvConnRead

Examples

This example waits for up to 10 seconds to get the next message from the connection to RTserver, processes the message, and finally destroys the message:

T_IPC_MSG msg; 
 
msg = TipcSrvConnMsgNext(srv, 10.0); 
if (msg == NULL) { 
  return;  /* error */ 
}  
 
if (!TipcSrvConnMsgProcess(srv, msg)) { 
  return;  /* error */ 
}  
 
if (!TipcMsgDestroy(msg)) { 
  return;  /* error */ 
}  

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