Exemple #1
0
 // Token: 0x06000154 RID: 340 RVA: 0x0000C750 File Offset: 0x0000A950
 public void run()
 {
     try
     {
         while (Session_ME.connected)
         {
             Message message = this.readMessage();
             if (message == null)
             {
                 break;
             }
             try
             {
                 if ((int)message.command == -27)
                 {
                     this.getKey(message);
                 }
                 else
                 {
                     Session_ME.onRecieveMsg(message);
                 }
             }
             catch (Exception)
             {
                 Cout.println("LOI NHAN  MESS THU 1");
             }
             try
             {
                 Thread.Sleep(5);
             }
             catch (Exception)
             {
                 Cout.println("LOI NHAN  MESS THU 2");
             }
         }
     }
     catch (Exception ex)
     {
         Debug.Log("error read message!");
         Debug.Log(ex.Message.ToString());
     }
     if (Session_ME.connected)
     {
         if (Session_ME.messageHandler != null)
         {
             if (Session_ME.currentTimeMillis() - Session_ME.timeConnected > 500)
             {
                 Session_ME.messageHandler.onDisconnected(Session_ME.isMainSession);
             }
             else
             {
                 Session_ME.messageHandler.onConnectionFail(Session_ME.isMainSession);
             }
         }
         if (Session_ME.sc != null)
         {
             Session_ME.cleanNetwork();
         }
     }
 }
Exemple #2
0
 // Token: 0x06000144 RID: 324 RVA: 0x0000C264 File Offset: 0x0000A464
 public void doConnect(string host, int port)
 {
     Session_ME.sc = new TcpClient();
     Session_ME.sc.Connect(host, port);
     Session_ME.dataStream = Session_ME.sc.GetStream();
     Session_ME.dis        = new BinaryReader(Session_ME.dataStream, new UTF8Encoding());
     Session_ME.dos        = new BinaryWriter(Session_ME.dataStream, new UTF8Encoding());
     new Thread(new ThreadStart(Session_ME.sender.run)).Start();
     Session_ME.MessageCollector @object = new Session_ME.MessageCollector();
     Cout.LogError("new -----");
     Session_ME.collectorThread = new Thread(new ThreadStart(@object.run));
     Session_ME.collectorThread.Start();
     Session_ME.timeConnected = Session_ME.currentTimeMillis();
     Session_ME.connecting    = false;
     Session_ME.doSendMessage(new Message(-27));
 }