111,126
社区成员
发帖
与我相关
我的任务
分享
System.Net.NetworkInformation.TcpConnectionInformation connection= Array.FindAll(
System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections(),
o => !System.Net.IPAddress.IsLoopback(o.LocalEndPoint.Address)
).FirstOrDefault();
if (connection != null)
{
string ip = connection.LocalEndPoint.Address.ToString();
}