Contents

Method

GetConnections

ModuleNetwork
LibraryCore
Action

Get current established TCP connections, for IPv4 and also IPv6 if available.

Parameters(None)
Return values

For each connection:

    • Class (string): "IPv4" or "IPv6".
    • LatencyMs (int): The smoothed round trip time in milliseconds from sending a packet to getting a response for this connection (introduced in v5.2 for Windows, null for other versions and platforms).
    • LocalAddress (string): The IP address on this host.
    • LocalPort (int): The port on this host.
    • PacketLossPercent (int): The amount of packets lost or discarded vs the number of packets sent and received successfully as a percentage (introduced in v5.2 for Windows, null for other versions and platforms). 
    • ProcessId (int): The PID of the process associated with the connection.
    • ProcessName (string): The name of the process associated with the connection.
    • RemoteAddress (string): The IP address on the remote host for an active outgoing connection; null if only listening.
    • RemotePort (int): The port on the remote host for an active outgoing connection; null if only listening.
Example
 Network.GetConnections();
Platforms
  • Windows
  • Linux
  • MacOS
Notes

Use Network.GetListeningEndpoints for the ports which are listening for incoming connections.

LatencyMs and PacketLossPercent are new from v5.2 and are null on every platform but Windows. Even on Windows PacketLossPercent is always null as this information is never non-zero, even in Windows' own Network Resource Monitor. (The performance counter information is not gathered, presumably for performance reasons.)