TCPIP_TCP_IsConnected Function

C

bool TCPIP_TCP_IsConnected(
    TCP_SOCKET hTCP
);

Description

This function determines if a socket has an established connection to a remote node. Call this function after calling TCPIP_TCP_ServerOpen()/TCPIP_TCP_ClientOpen() to determine when the connection is set up and ready for use.

Preconditions

TCP socket should have been opened with TCPIP_TCP_ServerOpen()/TCPIP_TCP_ClientOpen(). hTCP - valid socket.

Parameters

ParametersDescription
hTCPThe socket to check.

Returns

None.

Remarks

A socket is said to be connected only if it is in one of the states: TCPIP_TCP_STATE_ESTABLISHED, TCPIP_TCP_STATE_FIN_WAIT_1, TCPIP_TCP_STATE_FIN_WAIT_2 or TCPIP_TCP_STATE_CLOSE_WAIT In all of these states the socket can exchange data with the other end of the connection (either full duplex or only TX/RX).

Otherwise the call will return false.