Objectives
The purpose of this article is to provide details about the TCP status data when using the SktGetTCPStatus instruction for the NJ-series CPU.
Introduction
Generally, TCP status information is useful when executing socket communication instructions to perform TCP communications for the built-in EtherNet/IP Port. Issuing the SktGetTCPStatus instruction will read TCP socket state and return a response status. This article provides details for the response status not currently found in the NJ-series manuals.
These responses are the same as the CS/CJ EtherNet/IP units' responses to the FINS command SOCKET STATUS READ (2764). More detail can be found in the Sysmac CS and CJ Series EtherNet/IP Units Operation Manual (Cat. No. W465).
Content
The following socket status data (TcpStatus variable) is returned from the SktGetTCPStatus instruction depending on the state.
Status | Description | Explanation |
CLOSED | Connection closed | The socket is not being used. |
LISTEN | Waiting for connection | The socket is currently listening for incoming connections. |
SYS SENT | SYN sent in active status | The socket is actively trying to establish a connection. |
SYN RECEIVED | SYN received and sent | A connection request has been received. |
ESTABLISHED | Already established | The socket has an established connection. |
CLOSE WAIT | FIN received and waiting for completion | Waiting for the socket to close. |
FIN WAIT 1 | Completed and FIN sent. | The socket is closed and the connection is shutting down. |
CLOSING | Completed and exchanged FIN. Awaiting ACK | Sockets are stopped and waiting for remaining data. |
LAST ACK | FIN sent and completed. Awaiting ACK | The socket is closed and awaiting the acknowledgment. |
FIN WAIT 2 | Completed and ACK received. Awaiting FIN | The connection is closed and the socket is waiting for the FIN message. |
TIME WAIT | After closing, pauses twice the maximum segment life (2MSL) | The socket is waiting after closing to handle data packets that may still be on the network. The 2MSL timer starts at the TCP socket that first closes the socket and will run for 120 seconds in this status. |
The socket status transitions can occur in this order.
Summary
Understanding the meaning of socket status data can lead to more stable and predictable TCP communications with the NJ-series built-in EtherNet/IP unit.
References
Additional information about the performance of the NJ-series Built-in EtherNet/IP port can be found in the following article.
NJ501 EtherNet/IP Performance And Network Load
Additional information about the NJ-series built-in EtherNet/IP unit can be found in the following manuals:
- NJ-series Instructions Reference Manual (Cat. No. W502)
- NJ-series CPU Unit Built-in EtherNet/IP Port User's Manual (Cat. No. W506)