QTcpSocket is a QIOdevice. Use QIODevice::write(), QIODevice::read(), possibly even QTextStream or QDataStream, the resources that are already available to you, and some of your own initiative.