added methods to send to all in lobby

This commit is contained in:
Sem van der Hoeven
2020-10-13 13:28:18 +02:00
parent 52e83f111a
commit 1ae1b628f3
11 changed files with 193 additions and 6 deletions

View File

@@ -8,6 +8,15 @@ namespace SharedClientServer
{
class ClientServerUtil
{
// creates a message array to send to the server or to clients
public byte[] createPayload(byte id, string payload)
{
byte[] stringAsBytes = Encoding.ASCII.GetBytes(payload);
byte[] res = new byte[stringAsBytes.Length + 1];
res[0] = id;
Array.Copy(stringAsBytes, 0, res, 1, stringAsBytes.Length);
return res;
}
}
}