Exemplo n.º 1
0
        private void SendPacketRaw(ServerPacket packet)
        {
            Socket socket = SocketManager.GetSocket();

            byte[] payload = packet.GetPayload();
#if NETWORKDEBUG
            System.Net.IPEndPoint listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
            StringBuilder         sb = new StringBuilder();
            sb.AppendLine(String.Format("Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", payload.Length, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port));
            sb.AppendLine(payload.BuildPacketString());
            Console.WriteLine(sb.ToString());
#endif
            socket.SendTo(payload, session.EndPoint);
        }
Exemplo n.º 2
0
        private void SendPacketRaw(ServerPacket packet)
        {
            Socket socket = SocketManager.GetSocket();

            if (packet.Header.Sequence == 0)
            {
                socket = SocketManager.GetSocket(0);
            }

            byte[] payload = packet.GetPayload();

            if (packetLog.IsDebugEnabled)
            {
                System.Net.IPEndPoint listenerEndpoint = (System.Net.IPEndPoint)socket.LocalEndPoint;
                StringBuilder         sb = new StringBuilder();
                sb.AppendLine(String.Format("[{5}] Sending Packet (Len: {0}) [{1}:{2}=>{3}:{4}]", payload.Length, listenerEndpoint.Address, listenerEndpoint.Port, session.EndPoint.Address, session.EndPoint.Port, session.SubscriptionId));
                sb.AppendLine(payload.BuildPacketString());
                packetLog.Debug(sb.ToString());
            }
            socket.SendTo(payload, session.EndPoint);
        }