TipcConnFlush


Name

TipcConnFlush — flush buffered outgoing messages to connection’s socket

Synopsis

T_BOOL TipcConnFlush(conn) 
T_IPC_CONN conn; 

Arguments

conn — connection to flush

Return Values

TRUE if data was successfully flushed to connection, FALSE otherwise.

Diagnostics

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

Description

TipcConnFlush writes all buffered outgoing messages to a connection’s socket. Use TipcConnFlush sparingly. Calling it frequently will decrease response time, at the cost of increasing CPU consumption (due to the increased number of calls to the socket send function). If the connection’s block mode is TRUE or the connection’s write timeout is 0.0, then TipcConnFlush calls send once and returns. Otherwise TipcConnFlush calls send over and over until all data has been written, an error occurs, or the connection write timeout is reached. Examples of such errors include the socket being closed by the process at the other end of the connection.

If the connection’s auto flush size is not T_IPC_NO_AUTO_FLUSH, it is usually not necessary to call TipcConnFlush. In this case, TipcConnRead and TipcConnCheck always call TipcConnFlush to flush the connection’s write buffer. In addition, TipcConnMsgSend automatically calls TipcConnFlush if the number of buffered bytes of data is greater than the connection’s auto flush size.

If the connection’s auto flush size is 0, it is never necessary to call TipcConnFlush. In this case, TipcConnMsgSend always calls TipcConnFlush to flush the connection’s write buffer.

TipcConnFlush blocks if send blocks (that is, the socket’s internal buffer is full). If the flush fails (because send returns 0 or -1), the connection’s error callbacks are called to clean up, and TipcConnFlush returns FALSE.

Caution

None

See Also

TipcConnCheck, TipcConnGetAutoFlushSize, TipcConnRead

Examples

This example shows how to use TipcConnFlush to flush a message to a connection’s socket:

if (!TipcConnMsgSend(conn, msg)) { 
  return;  /* error */ 
}  
 
if (!TipcConnFlush(conn)) { 
    return;  /* error */ 
} 

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