#include <rtl.h>
U8 tcp_get_state (
U8 socket ); /* TCP socket to get the state of. */
Description
The tcp_get_state function determines the current state of
the TCP socket. Your application can use the tcp_get_state
function to monitor the progress when establishing a connection or
when closing the connection. The most useful state values are
TCP_STATE_CLOSED, TCP_STATE_LISTEN, and TCP_STATE_CONNECT. The
argument socket specifies the handle of the socket to get the
state of.
The tcp_get_state function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
Return Value
The tcp_get_state function returns the current state of the
TCP socket.
State
Description
TCP_STATE_FREE
Socket is free and not allocated yet. The function cannot
return this value.
TCP_STATE_CLOSED
Socket is allocated to an application but the connection is
closed.
TCP_STATE_LISTEN
Socket is listening for incoming connections.
TCP_STATE_SYN_REC
Socket has received a TCP packet with the flag SYN set.
TCP_STATE_SYN_SENT
Socket has sent a TCP packet with the flag SYN set.
TCP_STATE_FINW1
Socket has sent a FIN packet, to start the closing of the
connection.
TCP_STATE_FINW2
Socket has received acknowledgement from the remote machine
for the FIN packet it sent out from the local machine. Socket is
now waiting for a FIN packet from the remote machine.
TCP_STATE_CLOSING
Socket has received a FIN packet from the remote machine
independently
TCP_STATE_LAST_ACK
Socket is waiting for the last ACK packet to the FIN packet
it sent out.
TCP_STATE_TWAIT
Socket is waiting on a 2 ms timeout before closing the
connection.
TCP_STATE_CONNECT
Socket has established a TCP connection. You can transfer
data only in this state.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.