From 5226ed64de3f3bb5dd835fdc6d3f1adbfb8fe1de Mon Sep 17 00:00:00 2001 From: vis2k Date: Thu, 4 Apr 2019 13:09:25 +0200 Subject: [PATCH] List Server Example: warn gameserver if it tries to send a too big message which would be rejected by List Server --- Assets/Mirror/Examples/ListServer/ListServer.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Examples/ListServer/ListServer.cs b/Assets/Mirror/Examples/ListServer/ListServer.cs index 48448ab3a..800a62563 100644 --- a/Assets/Mirror/Examples/ListServer/ListServer.cs +++ b/Assets/Mirror/Examples/ListServer/ListServer.cs @@ -109,10 +109,15 @@ void SendStatus() char[] titleChars = gameServerTitle.ToCharArray(); writer.Write((ushort)titleChars.Length); writer.Write(titleChars); - - // send it writer.Flush(); - gameServerToListenConnection.Send(((MemoryStream)writer.BaseStream).ToArray()); + + // list server only allows up to 128 bytes per message + if (writer.BaseStream.Position <= 128) + { + // send it + gameServerToListenConnection.Send(((MemoryStream)writer.BaseStream).ToArray()); + } + else Debug.LogError("[List Server] List Server will reject messages longer than 128 bytes. Please use a shorter title."); } void TickGameServer()