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); }
public unsafe void SendPacket(IPacket packet) { _outputStream.Write(packet.GetByteSpan()); }
public unsafe bool SendPacketNoWait(IPacket packet) { return(_outputStream.WriteNoWait(packet.GetByteSpan())); }