From 873a6fa455c0505b86771531a5b86d29eeceee93 Mon Sep 17 00:00:00 2001 From: "derek.holloway" Date: Fri, 10 Jul 2026 14:29:31 -0700 Subject: [PATCH] Chage remoteAddress to mUDPClient --- MistoxServer/Client/MistoxClient.cs | 3 +-- MistoxServer/Client/UDPReceiver.cs | 6 +----- Todo.txt | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/MistoxServer/Client/MistoxClient.cs b/MistoxServer/Client/MistoxClient.cs index 040fb4b..a3db325 100644 --- a/MistoxServer/Client/MistoxClient.cs +++ b/MistoxServer/Client/MistoxClient.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Net; using System.Net.Sockets; using Mistox.ResevedPackets; @@ -62,7 +61,7 @@ namespace Mistox.Client { ///////////////////////////// public event Action onDataReceived; - public void InvokeOnReceived(dynamic DataPacket, IPEndPoint remote = null){ + public void InvokeOnReceived(dynamic DataPacket, mUDPClient remote = null){ switch (DataPacket as object) { case UserConnectedPacket packet: UserConnected(packet); diff --git a/MistoxServer/Client/UDPReceiver.cs b/MistoxServer/Client/UDPReceiver.cs index 267be72..5243dec 100644 --- a/MistoxServer/Client/UDPReceiver.cs +++ b/MistoxServer/Client/UDPReceiver.cs @@ -1,5 +1,4 @@ using System; -using System.Net; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; @@ -42,11 +41,8 @@ namespace Mistox.Client { // Extract the object dynamic buildObj = DataPacket.Deserialize( dataType, DataLength, data ); - // Map the IPEndPoint to a user - IPEndPoint endpoint = udpPacket.RemoteEndPoint; - // Return the object - _parent.InvokeOnReceived( buildObj, udpPacket.RemoteEndPoint ); + _parent.InvokeOnReceived( buildObj, client ); } } catch( Exception e ) { diff --git a/Todo.txt b/Todo.txt index d4679b3..793fbe2 100644 --- a/Todo.txt +++ b/Todo.txt @@ -1,5 +1,5 @@ -0. Messages sent from clients to clients or clients to the server dont have any information about who it came from on the receiving side? - Probably need to route the event handlers throught the client objects to be able to pull that information off of the packets as well. +Make a username -> connectionID dictionary for quick lookups instaed of using foreach loops with breaks. + 1. Allow the server to setup a server name 2. Allow the client to setup a user name 3. Have the client connect to the server with a welcome packet