From 62bb9bec96a7924a17fbb4d66de3aa9350579ec0 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Tue, 20 Oct 2015 19:40:55 +0200 Subject: [PATCH] Added broadcast --- ErgometerServer/DoctorThread.cs | 3 +++ ErgometerServer/Server.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ErgometerServer/DoctorThread.cs b/ErgometerServer/DoctorThread.cs index 5869ece..af798e3 100644 --- a/ErgometerServer/DoctorThread.cs +++ b/ErgometerServer/DoctorThread.cs @@ -40,6 +40,9 @@ namespace ErgometerServer case NetCommand.CommandType.CHAT: server.SendToClient(input); break; + case NetCommand.CommandType.BROADCAST: + server.BroadcastToClients(input.ChatMessage); + break; case NetCommand.CommandType.VALUESET: server.SendToClient(input); break; diff --git a/ErgometerServer/Server.cs b/ErgometerServer/Server.cs index 66f1e2d..6e9f07d 100644 --- a/ErgometerServer/Server.cs +++ b/ErgometerServer/Server.cs @@ -88,11 +88,11 @@ namespace ErgometerServer } } - public void BroadcastToClients(NetCommand command) + public void BroadcastToClients(string message) { foreach (ClientThread clientThread in clients) { - clientThread.SendToClient(command); + clientThread.SendToClient(new NetCommand(message, true, clientThread.session)); } }