I am working on a class that will implement a client for a certain Instant Messaging protocol.
I need to first make a HTTP request, then read the data and make another HTTP request with the processed data received from the first request and only after the second request i can open a tcp socket to the server.
What is the best way(best QT way?) to go about doing this as i haven’t found a way to block until HTTP request is over. I was considering using libcurl for this part but it seems a overkill to use another lib only for this.
I am working on a class that will implement a client for a certain
Share
QHttpwill send a set of signals to notify the state of a request. You may for example connectrequestFinished()signal to a slot that will process it and start your second request.Idea in pseudo-qt
Or as another solution you can smartly use locking structures such as
QMutexand wrap QHttp by implementing your own blocking request method, that will allow one request at time. But I think that in your case the first approach is better.