TipcConnGetBlockMode get the block mode of a connection
conn
connection to get block mode for
block_mode_return
storage for block mode
TRUE
if block mode was successfully retrieved from connection, FALSE
otherwise.
If TipcConnGetBlockMode fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcConnGetBlockMode gets the block mode of a connection. The block mode controls how TipcConnFlush behaves when a connection’s socket (write) buffer is full, how TipcConnRead behaves when a connection’s socket (read) buffer is empty, and how TipcConnAccept behaves when no new client is waiting to connect. The block mode setting is also related to the connection timeout properties. See TipcConnGetTimeout for more information on these timeout properties.
The default block mode is TRUE
. In this mode, TipcConnFlush does not return until all data has been written to the connection’s socket (or an error occurs), and TipcConnRead does not return until some data has been read from the connection’s socket, or an error occurs, or a specified amount of time has elapsed.
If block mode is FALSE
, the connection's socket flags are modified with the C function fcntl
to enable non-blocking socket operations. If the connection timeout properties are 0.0
, then TipcConnFlush returns FALSE
(and sets the global SmartSockets error number to T_ERR_WOULD_BLOCK) if not all buffered data can be sent, and TipcConnRead returns FALSE
(and sets the global SmartSockets error number to T_ERR_WOULD_BLOCK) if no data can be read. If the connection timeout properties are greater than 0.0
, then the amount of time TipcConnRead and TipcConnFlush can block is limited by the value of the connection properties.
If TipcConnGetBlockMode returns FALSE
, it does not store a value in block_mode_return
.
TipcConnFlush, TipcConnRead, TipcConnSetBlockMode
This example gets the block mode of a connection and prints it:
T_BOOL block_mode; if (!TipcConnGetBlockMode(conn, &block_mode)) {
return
; /* error */
} TutOut("The connection block mode is %d.\n", block_mode);
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |