After getting the socket that emitted the call through sender(), we post the information that a socket is being removed. Then, we remove the socket from m_clients, remove the associated buffer from m_receivedData and call deleteLater() on it. Do not use delete. Lastly, if no client is left, the disconnect button is disabled.
The server is ready. Now let's take a look at the client.