mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
List Server Example: warn gameserver if it tries to send a too big message which would be rejected by List Server
This commit is contained in:
parent
401455197f
commit
5226ed64de
@ -109,10 +109,15 @@ void SendStatus()
|
|||||||
char[] titleChars = gameServerTitle.ToCharArray();
|
char[] titleChars = gameServerTitle.ToCharArray();
|
||||||
writer.Write((ushort)titleChars.Length);
|
writer.Write((ushort)titleChars.Length);
|
||||||
writer.Write(titleChars);
|
writer.Write(titleChars);
|
||||||
|
|
||||||
// send it
|
|
||||||
writer.Flush();
|
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()
|
void TickGameServer()
|
||||||
|
Loading…
Reference in New Issue
Block a user