You need to use some of the 'QIODevice' functions, such as write
or <<
to send data to the client that is on the other end of the QTCPSocket.
So if you are serving webpages to a browser client, then you first listen (or use read commands) to their request, and then send over the appropriate response following the protocol that you are using.
So I would first set up this server on port 80 on your computer, and then open a browser to http://localhost
. Then use qDebug to print out the requests from your browser.
void Thread::readyRead()
{
qDebug() << Q_FUNC_INFO;
qDebug() << m_socket.readAll();
}
After you have that working, decide how you are going to parse the request, and then how you are going to respond, or what data you want to serve.
Also, be sure to check out the TCP examples in the See also for QTCPSocket.
Hope that helps.