Esempio n. 1
0
        private void OnGetHostEntryCompleted(IAsyncResult ar)
        {
            IPHostEntry     entry = null;
            SocketException error = null;

            try
            {
                try
                {
                    entry = Dns.EndGetHostEntry(ar);
                }
                catch (SocketException exc)
                {
                    error = exc;
                }

                if (entry != null)
                {
                    Send(entry);
                }
                else
                {
                    String    str     = ar.AsyncState as String;
                    IPAddress address = ar.AsyncState as IPAddress;

                    if ((address != null) || ((str != null) && IPAddress.TryParse(str, out address)))
                    {
                        Send(address, false);
                    }
                    else
                    {
                        errors.Enqueue(PscxErrorRecord.GetHostEntryError(ar.AsyncState.ToString(), error));
                    }
                }
            }
            finally
            {
                DecrementItemCount();
            }
        }
Esempio n. 2
0
 void IPscxErrorHandler.WriteGetHostEntryError(string host, Exception exc)
 {
     WriteError(PscxErrorRecord.GetHostEntryError(host, exc));
 }