// *** Old text based networking, still in ShellViewModel *** // Finishes receiving data from client, passes message to handler public override void ReceiveCallback(IAsyncResult asyncResult) { // Recreates client socket to handle connection Socket clientSocket = (Socket)asyncResult.AsyncState; // Stops infinite receive loop when client disconnects if (!SocketBase.IsConnected(clientSocket)) { PrintMessage($"Client {ClientSocketsInverse[clientSocket]} has disconnected"); // Removes client from dictionaries of connected clients ClientSockets.Remove(ClientSocketsInverse[clientSocket]); ClientSocketsInverse.Remove(clientSocket); return; } // Parent method called to finish receiving data and call handler base.ReceiveCallback(asyncResult); // Continues infinite receive loop Receive(clientSocket); }