TipcConnGetNumQueued


Name

TipcConnGetNumQueued — get number of queued messages from a connection

Synopsis

T_BOOL TipcConnGetNumQueued(conn, num_queued_return) 
T_IPC_CONN conn; 
T_INT4 *num_queued_return; 

Arguments

conn — connection from which to get number of queued messages

num_queued_return — storage for number of queued messages

Return Values

TRUE if number of queued messages was successfully retrieved from connection, FALSE otherwise.

Diagnostics

If TipcConnGetNumQueued fails, it returns FALSE and sets the global SmartSockets error number to:

Description

TipcConnGetNumQueued gets the number of queued messages from a connection. A connection has a priority queue of incoming messages. Messages are inserted into the queue with TipcConnMsgInsert (TipcConnRead uses TipcConnMsgInsert to insert newly read messages), may be removed from the front of the queue with TipcConnMsgNext, and may be removed from anywhere in the queue with TipcConnMsgSearch.

Caution

If TipcConnGetNumQueued returns FALSE, it does not store a value in num_queued_return.

See Also

TipcConnMsgNext, TipcConnMainLoop, TipcConnRead

Examples

This example prints the number of queued messages, then reads from a connection until at least three messages are available:

T_INT4 num_queued; 
if (!TipcConnGetNumQueued(conn, &num_queued)) { 
  return;  /* error */ 
}  
TutOut("The connection has %d queued messages.\n", num_queued); 
while (num_queued < 3) { 
  if (!TipcConnRead(conn, T_TIMEOUT_FOREVER)) { 
    return;  /* error */ 
  }  
  if (!TipcConnGetNumQueued(conn, &num_queued)) { 
    return;  /* error */ 
  }  
}  

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