As discussed earlier, using sender() is a convenient, but not an object-oriented, approach. Thus, try to use QSignalMapper instead to determine which socket called the slot. To achieve this, you have to connect the socket's readyRead() signal to a mapper and the slot directly. All the signal-mapper-related code will go into the newConnection() slot.
The same applies to the connection to the removeConnection() slot. Let's take a look at it next.