在第一步中,我检索本地NetworkInterface的GatewayAddress,如下所示: foreach (NetworkInterface f in NetworkInterface.GetAllNetworkInterfaces= OperationalStatus.Up) foreach (GatewayIPAddressInformation d in f.GetIPProperties().GatewayAddresses) ip = d.Address.ToStrin
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
var networkInterfacesSystem.Net.NetworkInformation.NetworkInterface.GetAllNetwo