qt4 - Qt and HTTP download -


I am working on a class that will implement the client for a quick instant messaging protocol.
I should first do an HTTP request, then read the data and request another HTTP request with the data received from the first request and only after the second request I can open a TCP socket on the server What is the best way (best QT way?) To go about doing this because I have not found any way to block HTTP requests. I was considering using libcurl for this part, but it seems that only one other liberalization is to be used.

QHttp A set of signals to inform the status of a request Will send. You can, for example, sign a slot with requestFinished () which will process it and start your second request

Idea in Pseudo-QT

  // Probably connect to constructor (myHttp, signal (request finite (int, boole)), this slot (request handler (int, boole)) // First call somewhere elsewhere. Reecc ID = myHttp-> Get ("first.com", buff); Zero request handler (int id, balls error) {if (error) panic (); If (ID == First Reich ID) {Process (Buff); SecondReqId = myHttp-> Get ("second.com", buff2); } If (id == seconds reck id) {process (buff 2); Sock.connectToHost ("server.com", "5222"); // etc}}  

Or as a second solution, you can use smartly locking structures like QMutex and your own blocking request method Implement QHttp by implementing it, which is a request on time but I think the first approach in your case is better.


Comments