示例#1
0
        private void sendPacketClientHandler(int clientId, IPacket packet)
        {
            client thisClient = clients[clientId];

            if (thisClient == null)
            {
                return;
            }

            try
            {
                var packetSpan = packet.GetByteSpan();

                thisClient.sendStream.Write(packetSpan);//(IntPtr)(pinnedBuffer), packetSpan.Length);
            }
            catch (MemoryStreamIsFull)
            {
                secondCommandsQueue.Enqueue(serverCommand.makeSendPacketCommand(clientId, packet));
            }
            setClientToWrite(thisClient);
        }
示例#2
0
 public unsafe void SendPacket(IPacket packet)
 {
     _outputStream.Write(packet.GetByteSpan());
 }
示例#3
0
 public unsafe bool SendPacketNoWait(IPacket packet)
 {
     return(_outputStream.WriteNoWait(packet.GetByteSpan()));
 }