标签:new return syn 服务器 ted connected port handle wait
/// <summary> /// 短时间判断是否可以连接 /// </summary> /// <param name="ipe"></param> /// <returns></returns> public static bool TestConnet(IPEndPoint ipe) { bool b = false; var client = new TcpClient(); try { var ar = client.BeginConnect(ipe.Address, ipe.Port, null, null); ar.AsyncWaitHandle.WaitOne(500); b = client.Connected; client.Close(); return b; } catch { return b; } finally { client.Close(); } }
标签:new return syn 服务器 ted connected port handle wait
原文地址:http://www.cnblogs.com/lijianda/p/7260949.html