// ----------------------------- Connect ---------------------------------
        // connect to the remote socket.
        public void Connect( )
        {
            mSocket = null;

            // make sure server name and port have been spcfd.
            if (Stringer.IsEmpty(mServerName) == true)
            {
                ThrowNetworkException("Connect error. Server name is empty.");
            }
            if (mServerPortNx == 0)
            {
                ThrowNetworkException("Connect error. Server port number is zero.");
            }

            // resolve and connect to the remote system.
            try
            {
                // resolve to the host server.
                IPHostEntry hostEntry = null;
                hostEntry = Dns.GetHostEntry(mServerName);

                // I guess Resolve returns a list of IP addresses. ( something to do with
                // IPv6 ). This loop is standard stuff pulled from the MS documenation.
                // Try to connect to each address until successful.
                foreach (IPAddress address in hostEntry.AddressList)
                {
                    IPEndPoint ep         = new IPEndPoint(address, mServerPortNx);
                    Socket     tempSocket = new Socket(
                        ep.AddressFamily,
                        SocketType.Stream,
                        ProtocolType.Tcp);

                    tempSocket.Connect(ep);

                    if (tempSocket.Connected == true)
                    {
                        ConnectedSocket = tempSocket;
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                ThrowNetworkException(
                    "Exception connecting to " + ServerPortCombo, e);
            }

            // throw exception if can't connect ...
            if (mSocket == null)
            {
                ThrowNetworkException("Failed to connect to " + ServerPortCombo);
            }
            else
            {
                AddMessage(NetworkRole.Client, "Connected to " + ServerPortCombo);
            }
        }
 // ------------------------ CalcServerRequiresAuthentication ----------------
 // Server requires authentication if the property is explicitly set or if the
 // Username and Password properties are set.
 private bool CalcServerRequiresAuthentication( )
 {
     if (mServerRequiresAuthentication != null)
     {
         return((bool)mServerRequiresAuthentication);
     }
     else if ((Stringer.IsEmpty(Username) == false) &&
              (Stringer.IsEmpty(Password) == false))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }