TCPSTATE enumeration (mstcpip.h)

The Windows Sockets TCPSTATE enumeration indicates the possible states of a Transmission Control Protocol (TCP) connection.

Syntax

typedef enum _TCPSTATE {
  TCPSTATE_CLOSED,
  TCPSTATE_LISTEN,
  TCPSTATE_SYN_SENT,
  TCPSTATE_SYN_RCVD,
  TCPSTATE_ESTABLISHED,
  TCPSTATE_FIN_WAIT_1,
  TCPSTATE_FIN_WAIT_2,
  TCPSTATE_CLOSE_WAIT,
  TCPSTATE_CLOSING,
  TCPSTATE_LAST_ACK,
  TCPSTATE_TIME_WAIT,
  TCPSTATE_MAX
} TCPSTATE;

Constants

 
TCPSTATE_CLOSED
The TCP connection has no connection state at all. This state represents the state when there is no Transmission Control Block (TCB), and therefore,
no connection.
TCPSTATE_LISTEN
The TCP connection is waiting for a connection request from any remote
TCP and port.
TCPSTATE_SYN_SENT
-The TCP connection is waiting for a matching connection request
after sending a connection request.
TCPSTATE_SYN_RCVD
The TCP connection is waiting for an acknowledgment that confirms the connection
request after both receiving and sending a
connection request.
TCPSTATE_ESTABLISHED
The TCP connection is an open connection, so the data received can be
delivered to the user. This state is normal state for the data transfer phase
of the connection.
TCPSTATE_FIN_WAIT_1
The TCP connection is waiting for a request to end the connection
from the remote TCP, or an acknowledgment of the previously sent request to end the connection.
TCPSTATE_FIN_WAIT_2
The TCP connection is waiting for a request to end the connection
from the remote TCP.
TCPSTATE_CLOSE_WAIT
The TCP connection is waiting for a request to end the connection
from the local user.
TCPSTATE_CLOSING
The TCP connection is waiting for an acknowledgment of the request to end the connection from the remote TCP.
TCPSTATE_LAST_ACK
The TCP connection is waiting for an acknowledgment of the request to end the connection that was previously sent to the remote TCP, which includes an acknowledgment of its request to end the connection.
TCPSTATE_TIME_WAIT
The TCP connection is waiting for enough time to pass to be sure
the remote TCP received the acknowledgment of its request to end the connection.
TCPSTATE_MAX
The maximum value of the TCPSTATE enumeration.

Remarks

A TCP connection progresses from one state to another in response to events. The events are the user calls OPEN, SEND, RECEIVE, CLOSE, ABORT, and STATUS; the incoming segments, particularly those containing the SYN, ACK, RST and FIN flags; and timeouts.

For more information about TCP connection states, see RFC 793.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1703 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Header mstcpip.h

See also

SIO_TCP_INFO

TCP_INFO_v0