What 's the system level api inside QApplication that QNetworkRequest utilize?
I am new to Qt. I see when using Qt make a http request, it will use QNetworkRequest and QNetworkReply, when I step into the source code of Qt, I see QNetworkRequest inherit from QNetworkRequestPrivate, and QNetworkRequestPrivate inherit from QSharedData and also some QSharedDataPointer stuff. I guess QApplication is a main thread, and QNetworkRequest will make
http call through QApplication, but what is the exact system level api QNetworkRequest utilize to make the http request? I step into QApplication trying to find it, but it's too complex for me. I hope I get some help here, and thank you so much for your time.
mlong last edited by
QNetworkRequest/QNetworkReplys are ultimately handled by a "QNetworkAccessManager":http://doc.qt.nokia.com/4.7/qnetworkaccessmanager.html. Offhand, I'm not sure what system-level API is used internally by that class, though the sources are available.
dangelog last edited by
bq. but what is the exact system level api QNetworkRequest utilize to make the http request?
What do you mean exactly with that?
Sorry that I didn't make the question clear..
It looks like QNetworkRequest and QNetworkReply just provide developers an access for http request. Finally QNetworkRequest/QNetworkReply/ need to call system level API for http request. It looks like QNetworkRequest send some signals to the slots of QApplication, and QApplication will call system level API ? But in Qt source code, I cannot find how Qt call System level http request(like windows socket,etc). In src/network/, it still looks like Qt level code ..
Thanks for any help!!
By the way, mlong, how do you make QNetworkAccessManager linked to its doc?
[quote author="mlong" date="1305077615"]QNetworkRequest/QNetworkReplys are ultimately handled by a "QNetworkAccessManager":http://doc.qt.nokia.com/4.7/qnetworkaccessmanager.html. Offhand, I'm not sure what system-level API is used internally by that class, though the sources are available.[/quote]
I just find in src/network/socket, there are qnativesocketengine_win.cpp and qnativesocketengine_unix.cpp, they make system level network call.
goetz last edited by
The actual protocol is implemented using the Qt classes - of course! The Trolls eat their own dog food. So, the HTTP classes use QTcpSocket, which in turn is based on the native sockets of the OS.
It's still unclear what's the intention behind your question. Do you need some special functionality or is it just for education that you want to understand the code?
mlong last edited by
I think you may be making some wrong assumptions about the functionality of QApplication. Its job isn't to dispatch native system calls itself. It, among other things, handles the application's main event loop which allows a lot of the messaging and interaction among Qt's classes.
[quote author="huyanke" date="1305136760"]By the way, mlong, how do you make QNetworkAccessManager linked to its doc?
I use the link button at the top of the "Post a reply" box and paste in the URL to the appropriate document. Nothing magic.
Edit: Combined 2 thoughts to keep from opening another post.