public static void Connect(this Socket socket, ref StringEndPoint endpoint, PriorityQuery <IPAddress> dnsPriorityQuery) { if (endpoint.ipEndPoint == null) { endpoint.ipEndPoint = new IPEndPoint(EndPoints.DnsResolve(endpoint.ipOrHost, dnsPriorityQuery), endpoint.port); } socket.Connect(endpoint.ipEndPoint); }
public StringEndPoint(StringEndPoint other, UInt16 port) { this.ipOrHost = other.ipOrHost; this.port = port; this.stringIsAnIP = other.stringIsAnIP; if (other.ipEndPoint == null) { this.ipEndPoint = null; } else { this.ipEndPoint = new IPEndPoint(other.ipEndPoint.Address, port); } }