C#中如何使用GetTcpTable API函数来取得本机的连接信息代码已经加了详细注释,我想有需要的同志一定会看得明白了 public class NativeFunc { [StructLayout(LayoutKind.Sequential)] public class MIB_TCPROW { public int dwState; public int dwLocalAddr; public int dwLocalPort; public int dwRemoteAddr; public int dwRemotePort; } [StructLayout(LayoutKind.Sequential)] public class MIB_TCPTABLE { public int dwNumEntries; public MIB_TCPROW[] table; } [DllImport("Iphlpapi.dll")] static extern int GetTcpTable(IntPtr pTcpTable, ref int pdwSize, bool bOrder); [DllImport("Iphlpapi.dll")] static extern int SendARP(Int32 DestIP, Int32 SrcIP, ref Int64 MacAddr, ref Int32 PhyAddrLen); [DllImport("Ws2_32.dll")] static extern Int32 inet_addr(string ipaddr); [DllImport("Ws2_32.dll")] static extern ushort ntohs(ushor