Class NetStat

java.lang.Object
oshi.driver.unix.NetStat

@ThreadSafe public final class NetStat extends Object
Utility to query TCP connections
  • Method Details

    • queryTcpnetstat

      public static Pair<Long,Long> queryTcpnetstat()
      Query netstat to obtain number of established TCP connections
      Returns:
      A pair with number of established IPv4 and IPv6 connections
    • queryNetstat

      public static List<InternetProtocolStats.IPConnection> queryNetstat()
      Query netstat to all TCP and UDP connections
      Returns:
      A list of TCP and UDP connections
    • queryTcpStats

      public static InternetProtocolStats.TcpStats queryTcpStats(String netstatStr)
      Gets TCP stats via netstat -s. Used for Linux and OpenBSD formats
      Parameters:
      netstatStr - The command string
      Returns:
      The statistics
    • queryUdpStats

      public static InternetProtocolStats.UdpStats queryUdpStats(String netstatStr)
      Gets UDP stats via netstat -s. Used for Linux and OpenBSD formats
      Parameters:
      netstatStr - The command string
      Returns:
      The statistics