On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTFiles-32
RTIP-32
RTIP-32 Programming Manual
Introduction
TCP/IP Networking
IP Packet Types
Sockets, IP, and Port Addresses
Blocking and Non-Blocking Sockets
MTU, MSS, and DCU
Fragmentation
UDP
TCP
Opening a TCP Connection
Closing a TCP Connection
TCP States
TCP Data Transfer
TCP Windows
TCP No Copy
Round Trip Time (RTT)
TCP Retransmission
TCP Keep Alive Packets
TCP Zero Window Probes
TCP Delayed Ack
TCP Silly Window Syndrome
TCP Nagle Algorithm
TCP Slow Start
TCP Congestion Avoidance
ICMP Source Quench
IGMP
Routing Table
ARP
NAT
Programming with RTIP-32
Demo Programs
PPP
DHCP Client
DHCP Server
FTP Client
FTP Server
TFTP Client
TFTP Server
Telnet Client
Telnet Server
Web Server
SNMP Agent
POP3 Client
SMTP Client
SNTP Client
SMB Server
SMB Client
SMB3 Server
SMB3 Client
WLAN Driver
RTIP-32 Reference Manual
RTPEG-32
RTUSB-32
|
TCP States
A TCP socket can be in one of the following states:
- TCP_S_CLOSED. The socket has been closed and may be freed.
- TCP_S_LISTEN. The socket is listening (waiting for the remote host to send a SYNC message).
- TCP_S_TWAIT. The closing handshaking has completed, waiting CFG_TWAITTIME before releasing the socket.
- TCP_S_SYNR. Listen transitions to SYNR when a SYNC message is received. A SYNC message has also been sent and the socket is waiting for an acknowledgment of its SYNC to transition to the established state.
- TCP_S_SYNS. A SYNC message has been sent (active open).
- TCP_S_EST. The connection is established.
- TCP_S_CWAIT. A FIN has been received (and an ack has been sent), but the application has not done a closesocket (we have not sent a FIN).
- TCP_S_FW1. A FIN has been sent (the application called closesocket), but the remote host has not acknowledged the FIN; a FIN has not been received from the remote host.
- TCP_S_FW2. A FIN has been sent (the application called closesocket) and acknowledged; a FIN has not been received from the remote host.
- TCP_S_CLOSING. Waiting for ACK of our FIN before completing close. A FIN has been received and acknowledged. In CLOSING, we send a FIN before receiving a FIN from the remote host.
- TCP_S_LAST. Waiting for ACK of our FIN before completing close. A FIN has been received and acknowledged. In the LAST state, we received a FIN before sending a FIN to the remote host.
- TCP_S_ALLOCED. Special state. The socket has been allocated, i.e. socket has been called, but the handshaking has not been started. A master socket is always in the ALLOCATED state, but its slave sockets are set to the LISTEN state immediately after being allocated.
- TCP_S_FREE. Special state. Not allocated.
The following diagram illustrates transitions between the various TCP socket states:
TCP State Transitions
TCP
Closing a TCP Connection
TCP Data Transfer
|