public static AvailableSocket TestGivenSocket(string ipAdr) { AvailableSocket tmp = new AvailableSocket(System.Net.IPAddress.Parse(ipAdr), port); try { SocketsList.Clear(); try { ControllerEndPoint = null; CurrentSocket = tmp; Communication.Type = CommunicationType.Network; CommunicationResult result = Communication.TestController(); if (result != CommunicationResult.Success) { tmp.Ip = System.Net.IPAddress.Parse("0.0.0.0"); } } catch { tmp.Ip = System.Net.IPAddress.Parse("0.0.0.0"); } } catch (Exception) { tmp.Ip = System.Net.IPAddress.Parse("0.0.0.0"); } ControllerEndPoint = null; CurrentSocket = new AvailableSocket(System.Net.IPAddress.Any, 0); return(tmp); }