IPEndPoint GetEndpoint(string host, int port) { IPAddress address; if (host == string.Empty || host == null) address = IPAddress.Any; else address = Dns.GetHostAddresses(host)[0]; return new IPEndPoint(address, port); }