If you have QTcpSocket you can use the peerAddress() method. With a descriptor you might try POSIX getpeername() function.