BytesRoad.Net.Sockets.SocketBase.GetHostByName C# (CSharp) Method

GetHostByName() static private method

static private GetHostByName ( string hostName ) : IPHostEntry
hostName string
return System.Net.IPHostEntry
        static internal IPHostEntry GetHostByName(string hostName)
        {
            IPHostEntry host = null;
            try
            {
                host = Dns.GetHostEntry(hostName);
            }
            catch (Exception)
            {
                host = null;
            }

            return host;
        }

Usage Example

 internal override void Bind(SocketBase socket)
 {
     base.CheckDisposed();
     this.SetProgress(true);
     try
     {
         IPHostEntry hostByName = SocketBase.GetHostByName(base._proxyServer);
         if (hostByName == null)
         {
             throw new SocketException(0x2af9);
         }
         IPEndPoint remoteEP = SocketBase.ConstructEndPoint(hostByName, base._proxyPort);
         base._socket.Connect(remoteEP);
         this.Negotiate();
         byte[] buffer = this.PrepareBindCmd((Socket_Socks5)socket);
         base.NStream.Write(buffer, 0, buffer.Length);
         byte[] reply = this.ReadVerifyReply();
         this._localEndPoint  = this.ExtractReplyAddr(reply);
         this._remoteEndPoint = null;
     }
     finally
     {
         this.SetProgress(false);
     }
 }
All Usage Examples Of BytesRoad.Net.Sockets.SocketBase::GetHostByName