Package oshi.software.os
Class InternetProtocolStats.IPConnection
- java.lang.Object
-
- oshi.software.os.InternetProtocolStats.IPConnection
-
- Enclosing interface:
- InternetProtocolStats
@Immutable public static final class InternetProtocolStats.IPConnection extends java.lang.Object
Encapsulates information associated with an IP connection.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
foreignAddress
private int
foreignPort
private byte[]
localAddress
private int
localPort
private int
owningProcessId
private int
receiveQueue
private InternetProtocolStats.TcpState
state
private int
transmitQueue
private java.lang.String
type
-
Constructor Summary
Constructors Constructor Description IPConnection(java.lang.String type, byte[] localAddress, int localPort, byte[] foreignAddress, int foreignPort, InternetProtocolStats.TcpState state, int transmitQueue, int receiveQueue, int owningProcessId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getForeignAddress()
Gets the foreign/remote address.int
getForeignPort()
Gets the foreign/remote port.byte[]
getLocalAddress()
Gets the local address.int
getLocalPort()
Gets the local port.int
getowningProcessId()
Gets the id of the process which holds this connection.int
getReceiveQueue()
Gets the size of the receive queue.InternetProtocolStats.TcpState
getState()
Gets the connection state (TCP connections only).int
getTransmitQueue()
Gets the size of the transmit queue.java.lang.String
getType()
Returns the connection protocol type, e.g., tcp4, tcp6, tcp46, udp4, udp6, udp46java.lang.String
toString()
-
-
-
Field Detail
-
type
private final java.lang.String type
-
localAddress
private final byte[] localAddress
-
localPort
private final int localPort
-
foreignAddress
private final byte[] foreignAddress
-
foreignPort
private final int foreignPort
-
state
private final InternetProtocolStats.TcpState state
-
transmitQueue
private final int transmitQueue
-
receiveQueue
private final int receiveQueue
-
owningProcessId
private int owningProcessId
-
-
Constructor Detail
-
IPConnection
public IPConnection(java.lang.String type, byte[] localAddress, int localPort, byte[] foreignAddress, int foreignPort, InternetProtocolStats.TcpState state, int transmitQueue, int receiveQueue, int owningProcessId)
-
-
Method Detail
-
getType
public java.lang.String getType()
Returns the connection protocol type, e.g., tcp4, tcp6, tcp46, udp4, udp6, udp46- Returns:
- The protocol type
-
getLocalAddress
public byte[] getLocalAddress()
Gets the local address. For IPv4 addresses this is a 4-byte array. For IPv6 addresses this is a 16-byte array.On Unix operating systems, the 16-bit value may be truncated, giving only the high order bytes. IPv6 addresses ending in zeroes should be considered suspect.
- Returns:
- The local address, or an empty array if the listener can accept a connection on any interface.
-
getLocalPort
public int getLocalPort()
Gets the local port.- Returns:
- The local port, or 0 if unknown, or any port.
-
getForeignAddress
public byte[] getForeignAddress()
Gets the foreign/remote address. For IPv4 addresses this is a 4-byte array. For IPv6 addresses this is a 16-byte array.On Unix operating systems, this value may be truncated. IPv6 addresses ending in zeroes should be considered suspect.
- Returns:
- The foreign/remote address, or an empty array if unknown. An empty array will also result if
-
getForeignPort
public int getForeignPort()
Gets the foreign/remote port.- Returns:
- The foreign/remote port, or 0 if unknown.
-
getState
public InternetProtocolStats.TcpState getState()
Gets the connection state (TCP connections only).- Returns:
- The connection state if known or relevant, null otherwise.
-
getTransmitQueue
public int getTransmitQueue()
Gets the size of the transmit queue. Not available on Windows.- Returns:
- The size of the transmit queue, or 0 if unknown.
-
getReceiveQueue
public int getReceiveQueue()
Gets the size of the receive queue. Not available on Windows.- Returns:
- The size of the receive queue, or 0 if unknown.
-
getowningProcessId
public int getowningProcessId()
Gets the id of the process which holds this connection.- Returns:
- The process id of the process which holds this connection if known, -1 otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-