From ad5b903d362749a4775a84320b98e2ee7cff5660 Mon Sep 17 00:00:00 2001 From: "derek.holloway" Date: Mon, 3 Aug 2026 13:26:46 -0700 Subject: [PATCH] Part of the last commit --- MistoxServer/Client/MistoxClient.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/MistoxServer/Client/MistoxClient.cs b/MistoxServer/Client/MistoxClient.cs index 0189b31..0648506 100644 --- a/MistoxServer/Client/MistoxClient.cs +++ b/MistoxServer/Client/MistoxClient.cs @@ -13,7 +13,7 @@ namespace Mistox.Client { public string UserName { get; private set; } = ""; // My UserName public bool Alive { get; set; } = true; // Is the server running public bool isAuthenticated { get; set; } = false; // Is the server authenticated - public ConcurrentDictionary clientConnections; // UserName, Connection + public ConcurrentDictionary clientConnections { get; private set; } // UserName, Connection public mTCPClient ServerConnection {get; private set; } // Global TCP Server Connection public UdpClient ClientSocket { get; private set; } // Global UDP Sender @@ -126,6 +126,26 @@ namespace Mistox.Client { Alive = false; onServerDisconnected?.Invoke(); } + + + public async Task SendAllClients(Packet data) { + foreach( mUDPClient cur in clientConnections.Values ){ + await cur.Send( data ); + } + } + + public async Task SendClient(string UserName, Packet data) { + foreach( mUDPClient cur in clientConnections.Values ) { + if (cur.UserName.ToLower() == UserName.ToLower()) { + await cur.Send( data ); + break; + } + } + } + + public async Task SendServer(Packet data) { + await ServerConnection.Send( data ); + } } }