Ejemplo n.º 1
0
 internal void ConnectServer()
 {
     try
     {
         if (((this.client == null) || !this.client.ServerPoint.Address.ToString().Equals(Config.serverIP)) || (this.client.ServerPoint.Port != int.Parse(Config.serverPort)))
         {
             this.client = new MyUdpClient(Config.serverIP, int.Parse(Config.serverPort), int.Parse(Config.clientPort));
             this.client.MaxConnWaitTime  = int.Parse(Config.maxConnWaitTime);
             this.client.LoginOKEvent    += Login;
             this.client.ReceiveMsgEvent += getMess;
             this.client.StopEvent       += stopMess;
             this.client.ReConnectEvent  += ReConnectServer;
         }
         if (!this.client.IsConnected)
         {
             this.client.Connect(this.userName, this.userID + "." + MD5_Crypt.GetHashString32(this.userID + "saxiTAO"), Config.maxMessID);
         }
     }
     catch (Exception exception)
     {
         this.log.ErrorFormat("登录公告服务器异常:{0}", exception.ToString());
     }
 }