Is it possible to set a timeout when performing a port lookup as demonstrated in the code below?:
try
{
System.Net.Sockets.Socket sock = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
sock.Connect(ipa, portno1);
if (sock.Connected == true) // Port is in use and connection is successful
{
displayGreen1();
}
sock.Close();
}