1. reference using System.Net.NetworkInformation; 2. add code IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties(); // TcpConnectionInformation connections = properties.GetActiveTcpConnections(); TcpConnectionInformation[] connections = properties.GetActiveTcpConnections(); foreach (TcpConnectionInformation t in connections) { Console.Write("Local endpoint: {0} ",t.LocalEndPoint.Address); Console.Write("Remote endpoint: {0} ",t.RemoteEndPoint.Address); Console.WriteLine("{0}",t.State); } Console.WriteLine();
2012年10月15日 星期一
c# create a netstat clone
Reference
Labels:
C#

訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言