Пример #1
0
 /// <summary>
 /// Note: Since this is a struct and this function can modify the fields of the struct,
 /// make sure you are calling this on a "ref" version of the struct, and if it's a member
 /// of another object, make sure it IS NOT readonly.
 /// </summary>
 /// <param name="dnsPriorityQuery">Callback that determines priority to select an address from Dns record.
 ///   Use DnsPriority.(QueryName) for standard queries.</param>
 public void ForceIPResolution(PriorityQuery <IPAddress> dnsPriorityQuery)
 {
     if (ipEndPoint == null)
     {
         ipEndPoint = new IPEndPoint(EndPoints.DnsResolve(ipOrHost, dnsPriorityQuery), port);
     }
 }
Пример #2
0
 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);
 }
Пример #3
0
        public void DnsRefreshAddress()
        {
            IPAddress newAddress = EndPoints.DnsResolve(domainName, dnsPriorityQuery);

            if (lastRefreshEndPoint == null || !lastRefreshIPAddress.Equals(newAddress))
            {
                //if (lastRefreshEndPoint != null)
                //Console.WriteLine("[DnsEndPointDebug] Address is different old='{0}' new='{1}'", lastRefreshIPAddress, newAddress);
                this.lastRefreshIPAddress = newAddress;
                this.lastRefreshEndPoint  = new IPEndPoint(newAddress, port);
            }
        }