每次都要10s钟左右才能 返回false 值,有没有办法修改? 只要连接不上,立刻返回false IPAddress ServeIP = IPAddress.Parse(a_strNetIP); IPEndPoint remoteEP = new IPEndPoint(ServeIP, Int32.Parse(a_strPort)); Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);try{ clientSocket.ReceiveTimeout = 500; clientSocket.SendTimeout = 500; clientSocket.Connect(remoteEP);return true; }
catch
{
return false;
}
森林海
相关分类