Exemple #1
0
        public static LoginResult LoginToServer(string user, string password, string serverName, int port)
        {
            m_UserName = user;
            m_Password = password;

            LoginResult result;

            try
            {
                if (!IsConnected)
                {
                    // resolve the server name to an IP address
                    string serverIP = ResolveDNS(serverName);

                    // create the remote instance of the OrbConnection object
                    CreateConnectionObject(serverIP, port);
                }

                result = m_Connection.LoginToServer(new OrbClientInfo(m_ClientID, m_UserName), m_Password);
            }
            catch (Exception e)
            {
                result = new LoginResult(LoginCodes.ConnectionFailure, "Connection Failed\n" + e.Message, e);
            }

            if (result.Code != LoginCodes.Success)
            {
                m_Connection = null;
            }

            return(result);
        }
Exemple #2
0
 public static void Disconnect()
 {
     if (IsConnected)
     {
         m_Connection.Disconnect(m_ClientID);
         m_Connection = null;
     }
 }
Exemple #3
0
 private static void CreateConnectionObject(string serverIP, int port)
 {
     m_Connection = (OrbConnection)Activator.GetObject(typeof(OrbConnection)
                                                       , string.Format("tcp://{0}:{1}/OrbConnection", serverIP, port.ToString()));
 }