我尝试使用以下代码测试TCP连接。
如何在IP或端口无效时设置超时?
System.Threading.Thread t = new System.Threading.Thread(() =>
{
using (TcpClient client = new TcpClient())
{
client.Connect(ip, Convert.ToInt32(port));
}
});
t.Start();
如何在IP或端口无效时设置超时?