public void SendTcpPacket(ClientPacketType clientPacketType, Packet packet)
        {
            packet.WriteLength();
            tcpConnection.SendPacket(packet);

            Logger.LogEvent(LoggerSection.Network, $"Sent «{Helpers.GetEnumName(clientPacketType)}» TCP packet to the server");
        }
Example #2
0
        public void ProcessPacket(int packetTypeId, Packet packet, bool isTcp)
        {
            string protocolName = isTcp ? "TCP" : "UDP";

            Logger.LogEvent(LoggerSection.Network, $"Received «{Helpers.GetEnumName((ServerPacketType) packetTypeId)}» {protocolName} packet from server");

            packetHandlers[packetTypeId](packet);
        }
        public void SendUdpPacket(ClientPacketType clientPacketType, Packet packet)
        {
            if (udpConnection == null)
            {
                Logger.LogNotice(LoggerSection.Network, "Unable to send udp packet, because udp connection is down");
                return;
            }

            packet.WriteLength();
            udpConnection.SendPacket(packet);

            Logger.LogEvent(LoggerSection.Network, $"Sent «{Helpers.GetEnumName(clientPacketType)}» UDP packet to the server");
        }