What just happened?

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.

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.