public static void Send(Connection pCon, Packet.SendPacketHandlers.Packet p)
        {
            int packetLength = 0;

            byte[] sendBuffer;
            sendBuffer = p.Compile(pCon.client.PrivateKey, pCon.client.SendKeyOffset, out packetLength);
            pCon.client.SendKeyOffset++;
            if (pCon.client.SendKeyOffset >= pCon.client.PrivateKey.Length)
            {
                pCon.client.SendKeyOffset = 0;
            }
            if (Program.DEBUG_send)
            {
                string text;
                text = String.Format("GameServerSend::SEND Send packet type: 0x{0:x2} Length: {1} and after crypt: {2}", p.PacketType, p.PacketLength, packetLength);
                Output.WriteLine(text);
            }
            //sendQueue.Enqueue(sendBuffer);
            //connectedSocket.BeginSend(sendBuffer, 0, packetLength, 0, new AsyncCallback(SendCallback), connectedSocket);
            //using blocking send mayby async will be bether??
            try
            {
                int iResult = pCon.SendSocket.AcceptSocket.Send(sendBuffer, 0, packetLength, 0);
                if (iResult == (int)SocketError.SocketError)
                {
                    Output.WriteLine("GameServerSend::Send -  Send failed with error: " + iResult.ToString());
                }
            }
            catch (ObjectDisposedException e)
            {
                Output.WriteLine("GameServerSend::Send -  Send failed with error: " + e.ToString());
            }
        }
Beispiel #2
0
 internal StopMove(int x, int y, Packet.SendPacketHandlers.Packet packet) : base(packet)
 {
     newX = x;
     newY = y;
 }
Beispiel #3
0
 internal State(Packet.SendPacketHandlers.Packet packet)
 {
     this.packet = packet;
 }