From 709af8d3ecc837e7c7ad8779a9d187c55452a951 Mon Sep 17 00:00:00 2001 From: Sanae Date: Tue, 15 Mar 2022 17:28:15 -0600 Subject: [PATCH] Send buffer 1 on another oscket --- Server/Server.cs | 1 + TestClient/Program.cs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Server/Server.cs b/Server/Server.cs index 0b762a6..6bfb12a 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -28,6 +28,7 @@ public class Server { while (true) { Socket socket = token.HasValue ? await serverSocket.AcceptAsync(token.Value) : await serverSocket.AcceptAsync(); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true); + socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1); Logger.Warn($"Accepted connection for client {socket.RemoteEndPoint}"); diff --git a/TestClient/Program.cs b/TestClient/Program.cs index 7a98da4..d0e4a87 100644 --- a/TestClient/Program.cs +++ b/TestClient/Program.cs @@ -70,9 +70,11 @@ async Task S(string n, Guid otherId, Guid ownId) { PacketType type = header.Type; if (header.Id != otherId) continue; if (reboundPackets.All(x => x != type)) continue; - if (type == PacketType.Player) { - PlayerPacket packet = new PlayerPacket(); - packet. + if (type == PacketType.Tag) { + TagPacket packet = new TagPacket(); + packet.Deserialize(owner.Memory.Span[Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize)]); + packet.IsIt = true; + packet.Serialize(owner.Memory.Span[Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize)]); } header.Id = ownId; MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header);