/// <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(); } }