TipcConnFlush flush buffered outgoing messages to connection’s socket
conn
connection to flush
TRUE
if data was successfully flushed to connection, FALSE
otherwise.
If TipcConnFlush fails, it returns FALSE
and sets the global SmartSockets error number to one of:
conn
was nullEOF
has been reached). Destroy the connection and create a new one if necessary.FALSE
, and not all data could be sent without blocking
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
.
None
TipcConnCheck, TipcConnGetAutoFlushSize, TipcConnRead
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 |