Dagen slutt

This commit is contained in:
Geir Okkenhaug Jerstad 2025-01-06 14:49:31 +01:00
parent 8dfac53540
commit 6361e14b88
6 changed files with 37 additions and 2 deletions

View file

@ -0,0 +1,28 @@
namespace DIP.ChatServer;
public class ChatServer
{
private readonly List<ChatClient> _clients;
public ChatServer()
{
_clients = new List<ChatClient>();
}
public void Broadcast(ChatClient client, string message)
{
foreach (var chatClient in _clients)
{
if (chatClient != client)
{
chatClient.Receive(message);
}
}
}
public void Register(ChatClient client)
{
_clients.Add(client);
}
}

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>