c# socket 判断端口是否被占用

using System.Net;
using System.Net.Sockets;
using System.Net.NetworkInformation;

            IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
            IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners();
            foreach (var item in ipEndPoints)
            {

            }

 

posted @ 2015-06-08 15:07  pengbg  阅读(2266)  评论(0编辑  收藏  举报