Example #1
0
        public void DocModem(int _fromClient, Packet _packet)
        {
            int    _clientIdCheck = _packet.ReadInt();
            string _imei          = _packet.ReadString();

            Console.WriteLine($"{clients[_fromClient].tcp.socket.Client.RemoteEndPoint} connected successfully and is now player {_fromClient}.");
            if (_fromClient != _clientIdCheck)
            {
                Console.WriteLine($"Imei \"{_imei}\" (ID: {_fromClient}) has assumed the wrong client ID ({_clientIdCheck})!");
            }
            //Kiem tra doc trong thread;
            ThreadManager.ExecuteOnMainThread(() =>
            {
                int modemid = listPorts[currentPort].imei[_imei];
                //
                string docmodem = UtilityModem.encrypt(UtilityModem.DOCMODEM);
                listPorts[currentPort].clients[modemid].tcp.SendData(Encoding.ASCII.GetBytes(docmodem));
            });
            //
        }
Example #2
0
        public void DocModem(int _fromClient, Packet _packet)
        {
            opId = _packet.ReadInt();
            string _imei = _packet.ReadString();

            Console.WriteLine($"{clients[_fromClient].tcp.socket.Client.RemoteEndPoint} connected successfully and is now player {_fromClient}.");
            if (_fromClient != opId)
            {
                Console.WriteLine($"Imei \"{_imei}\" (ID: {_fromClient}) has assumed the wrong client ID ({opId})!");
            }
            //Kiem tra doc trong thread;
            ThreadManager.ExecuteOnMainThread(() =>
            {
                int modemid = imei[_imei];
                //
                string docmodem = UtilityModem.encrypt(UtilityModem.DOCMODEM);
                clients[modemid].tcp.SendData(Encoding.ASCII.GetBytes(docmodem));
                //Đọc kết quả
                //Packet packet = new Packet(4);
                //clients[modemid].tcp.ReadData(_fromClient,packet);
                waitModem = true;
            });
            //
        }