Esempio n. 1
0
        // 메시지 전송 버튼
        private void ChatSendBtn_Click(object sender, EventArgs e)
        {
            // 입력된 값 없이 전송을 누르면 아무 작업도 하지 않는다
            if (chatInText.Text == null)
            {
                return;
            }
            // 클릭하면 텍스트를 가져와 패킷화한다
            var RoomChatPacket = new RoomChatReqPacket();

            RoomChatPacket.SetValue(chatInText.Text);
            PostSendPacket(PACKET_ID.ROOM_CHAT_REQ, RoomChatPacket);
        }
Esempio n. 2
0
        public void PostSendPacket(PACKET_ID packetID, RoomChatReqPacket packet)
        {
            if (Network.IsConnected() == false)
            {
                Console.WriteLine("서버 연결이 되어 있지 않습니다.");
                return;
            }
            //Int16 BodyDataSize = (Int16)bodyData.Length;
            //var PacketSize = (Int16)bodyData.Length;//BodyDataSize + PacketDef.PACKET_HEADER_SIZE;
            var PacketSize = packet.GetMsgLen() + PacketDef.PACKET_HEADER_SIZE;
            var BodyData   = packet.GetMsg();

            List <byte> dataSource = new List <byte>();

            dataSource.AddRange(BitConverter.GetBytes((Int16)PacketSize));
            dataSource.AddRange(BitConverter.GetBytes((Int16)packetID));
            dataSource.AddRange(BodyData);
            SendPacketQueue.Enqueue(dataSource.ToArray());
        }