using System.Net.NetworkInformation;
// Get all
var tcpConnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections();
// Where Established
var establishedConnections = tcpConnections.Where(conn => conn.State == TcpState.Established);
return establishedConnections.Count();