public static enum NetStat.BusyPort.TcpState extends java.lang.Enum<NetStat.BusyPort.TcpState>
This class maps the states observed by the utilities used to examine the TCP connections on the platform to a common form. Where the state maps to a state described in RFC-793 Transmission Control Protocol, that state name is used for the enumeration constant.
The following diagram shows the usual TCP state transitions. For a discussion of this diagram, see RFC-793 Transmission Control Protocol and TCP/IP Illustrated, Volume 1, 1ed: The Protocols by W. Richard Stevens.
![]() |
![]() |
nettop utility used for Mac OS X is closed source but source for a variant
(netbottom.c) is available. The TCP state constants returned by nettop
are neither documented nor listed in an available source file. The values used in this
enum are presumed from the known values and the names of external references,
in the form of kNStatSrcTcpStateXxxxxxxxxx, made by netbottom.c.netbottom.c Sources,
"Stevens, W. Richard (1994) TCP/IP Illustrated, Volume 1, 1ed: The Protocols, Addison-Wesley",
RFC-793 Transmission Control Protocol| Enum Constant and Description |
|---|
BOUND
Awaiting application
listen, connect, accept, or close call following bind (lsof). |
CLOSE
Awaiting application
close following a socket/connection error (lsof/Linux). |
CLOSE_WAIT
Awaiting application-level connection termination (socket close) (RFC-793).
|
CLOSED
Not connected (RFC-793).
|
CLOSING
Awaiting connection termination request acknowledgement from remote (RFC-793).
|
DELETE_TCB
Indicates the control block representing the TCP connection is being deleted (MSFT_NetTCPConnection).
|
ESTABLISHED
An "open" TCP connection over which data may be transferred (RFC-793).
|
FIN_WAIT_1
Awaiting connection termination request or acknowledgement of sent connection termination request from remote (RFC-793).
|
FIN_WAIT_2
Awaiting connection termination request from remote (RFC-793).
|
IDLE
Awaiting application
bind, connect, or close on socket (lsof). |
LAST_ACK
Awaiting acknowledgement of connection termination request sent to remote (RFC-793).
|
LISTEN
Awaiting a connection request (RFC-793).
|
SYN_RECEIVED
Awaiting connection request acknowledgement after having sent and received a connection request (RFC-793).
|
SYN_SENT
Awaiting a matching connection request after having sent a connection request (RFC-793).
|
TIME_WAIT
Awaiting expiration of TCP implementation-defined timeout before socket of closed connection can be re-used (RFC-793).
|
UNKNOWN
Connection state is unknown (MSFT_NetTCPConnection).
|
| Modifier and Type | Method and Description |
|---|---|
static NetStat.BusyPort.TcpState |
fromLsofString(java.lang.String lsofStateString)
Determine the
TcpCode from the state string from the lsof command. |
static NetStat.BusyPort.TcpState |
fromMicrosoftNumber(int msStateNumber)
Determine the
TcpState from the state number corresponding to a Microsoft
System.Net.NetworkInformation.TcpState enum value. |
static NetStat.BusyPort.TcpState |
fromMicrosoftString(java.lang.String msStateString)
Determine the
TcpState from the state string from the Microsoft Get-NetTCPConnection cmdlet. |
static NetStat.BusyPort.TcpState |
fromNettopString(java.lang.String nettopStateString)
Determine the
TcpCode from the state string from the nettop command. |
static NetStat.BusyPort.TcpState |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static NetStat.BusyPort.TcpState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NetStat.BusyPort.TcpState UNKNOWN
public static final NetStat.BusyPort.TcpState CLOSED
public static final NetStat.BusyPort.TcpState LISTEN
public static final NetStat.BusyPort.TcpState SYN_SENT
public static final NetStat.BusyPort.TcpState SYN_RECEIVED
public static final NetStat.BusyPort.TcpState ESTABLISHED
public static final NetStat.BusyPort.TcpState FIN_WAIT_1
public static final NetStat.BusyPort.TcpState FIN_WAIT_2
public static final NetStat.BusyPort.TcpState CLOSE_WAIT
public static final NetStat.BusyPort.TcpState CLOSING
public static final NetStat.BusyPort.TcpState LAST_ACK
public static final NetStat.BusyPort.TcpState TIME_WAIT
public static final NetStat.BusyPort.TcpState DELETE_TCB
public static final NetStat.BusyPort.TcpState BOUND
listen, connect, accept, or close call following bind (lsof).public static final NetStat.BusyPort.TcpState CLOSE
close following a socket/connection error (lsof/Linux).public static final NetStat.BusyPort.TcpState IDLE
bind, connect, or close on socket (lsof).public static NetStat.BusyPort.TcpState[] values()
for (NetStat.BusyPort.TcpState c : NetStat.BusyPort.TcpState.values()) System.out.println(c);
public static NetStat.BusyPort.TcpState valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static NetStat.BusyPort.TcpState fromNettopString(java.lang.String nettopStateString)
TcpCode from the state string from the nettop command.nettopStateString - the state string from nettopTcpState corresponding to nettopStateStringjava.lang.EnumConstantNotPresentException - if nettopStateString is not a recognized TcpStatepublic static NetStat.BusyPort.TcpState fromLsofString(java.lang.String lsofStateString)
TcpCode from the state string from the lsof command.lsofStateString - the state string from lsofTcpState corresponding to lsofStateStringjava.lang.EnumConstantNotPresentException - if lsofStateString is not a recognized TcpStatepublic static NetStat.BusyPort.TcpState fromMicrosoftString(java.lang.String msStateString)
TcpState from the state string from the Microsoft Get-NetTCPConnection cmdlet.msStateString - the state string from the Get-NetTCPConnection cmdletTcpState corresponding to msStateStringjava.lang.EnumConstantNotPresentException - if msStateString is not a recognized TcpStatepublic static NetStat.BusyPort.TcpState fromMicrosoftNumber(int msStateNumber)
TcpState from the state number corresponding to a Microsoft
System.Net.NetworkInformation.TcpState enum value.msStateNumber - the TcpState enum numberTcpState corresponding to msStateNumberjava.lang.EnumConstantNotPresentException - if msStateNumber is not a recognized TcpStateCopyright © 2023. All rights reserved.