Package oshi.driver.unix
Class NetStat
java.lang.Object
oshi.driver.unix.NetStat
@ThreadSafe public final class NetStat extends java.lang.Object
Utility to query TCP connections
-
Method Summary
Modifier and Type Method Description static java.util.List<InternetProtocolStats.IPConnection>
queryNetstat()
Query netstat to all TCP and UDP connectionsstatic Pair<java.lang.Long,java.lang.Long>
queryTcpnetstat()
Query netstat to obtain number of established TCP connectionsstatic InternetProtocolStats.TcpStats
queryTcpStats(java.lang.String netstatStr)
Gets TCP stats vianetstat -s
.static InternetProtocolStats.UdpStats
queryUdpStats(java.lang.String netstatStr)
Gets UDP stats vianetstat -s
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
queryTcpnetstat
Query netstat to obtain number of established TCP connections- Returns:
- A pair with number of established IPv4 and IPv6 connections
-
queryNetstat
Query netstat to all TCP and UDP connections- Returns:
- A list of TCP and UDP connections
-
queryTcpStats
Gets TCP stats vianetstat -s
. Used for Linux and OpenBSD formats- Parameters:
netstatStr
- The command string- Returns:
- The statistics
-
queryUdpStats
Gets UDP stats vianetstat -s
. Used for Linux and OpenBSD formats- Parameters:
netstatStr
- The command string- Returns:
- The statistics
-