Exemple #1
0
        private void Send_Reconnect_Req()
        {
            Msg_Reconnect_Req req = new Msg_Reconnect_Req();

            req.session_key   = _session_key;
            req.session_token = _session_token;
            string json = JsonUtility.ToJson(req);

            byte[] data = System.Text.Encoding.UTF8.GetBytes(json);

            Gamnet.Packet packet = new Gamnet.Packet();
            packet.length   = (ushort)(Packet.HEADER_SIZE + data.Length);
            packet.msg_seq  = ++_send_seq;
            packet.msg_id   = MsgID_CliSvr_Reconnect_Req;
            packet.reliable = false;
            packet.Append(data);

            List <Gamnet.Packet> tmp = new List <Gamnet.Packet>(_send_queue);

            _send_queue.Clear();
            _send_queue_idx = 0;

            Debug.Log("[Session.Send_Reconnect_Req] send reconnect req(msg_seq:" + packet.msg_seq + ", disconnect_state:" + _disconnectState.ToString() + ", json:" + json + ")");
            SendMsg(packet);

            foreach (var itr in tmp)
            {
                itr.read_index = 0;
                _send_queue.Add(itr);
            }
        }
Exemple #2
0
        void Send_Reconnect_Req()
        {
            Msg_Reconnect_Req req = new Msg_Reconnect_Req();

            req.session_key   = _session_key;
            req.session_token = _session_token;
            string json = JsonUtility.ToJson(req);

            Debug.Log("send reconnect message(" + json + ")");
            byte[] data = System.Text.Encoding.UTF8.GetBytes(json);

            Gamnet.Packet packet = new Gamnet.Packet();
            packet.length   = (ushort)(Packet.HEADER_SIZE + data.Length);
            packet.msg_seq  = ++_msg_seq;
            packet.msg_id   = MsgID_Reconnect_Req;
            packet.reliable = false;
            packet.Append(data);

            SendMsg(packet);
        }