qt - Working with multiple network sessions simultaneously -



qt - Working with multiple network sessions simultaneously -

how can send requests on 2 network interfaces using qtwebkit? test code seems utilize same interface. question is:

does webkit care qnetworksession?: if not, how can forcefulness webkit utilize specific network interface?

sample code:

// main.cpp qlist<qnetworksession*> sessions; qlist<qnetworkconfiguration> configs = configmanager.allconfigurations(qnetworkconfiguration::active); foreach (const qnetworkconfiguration& config, configs) { sessions << new qnetworksession(config); qdebug() << "preparing network session on " << config.name(); } foreach (qnetworksession* session, sessions) { qwebpage* page = new qwebpage(); pageviewer* viewer = new pageviewer(0); qobject::connect(page,signal(loadfinished(bool)),viewer,slot(showresults(bool))); viewer->setpage(page); page->setnetworkaccessmanager(&accessmanager); session->open(); qdebug() << "internal ip reported interface is:\t\t" << session->interface().addressentries().at(0).ip().tostring(); session->waitforopened(); page->mainframe()->load(qurl("http://wtfismyip.com/text")); session->close(); } // page-viewer.cpp void pageviewer::showresults(bool results) { qdebug() << "external ip reported `http://wtfismyip.com/text' is:\t" << this->page->mainframe()->toplaintext().trimmed(); }

qnetworksession defines if interface available, has no effect on routing of packets.

qtwebkit passes network connection through qnetworkaccessmanager::get, , through qtcp/sslsocket, don't think uses qabstractsocket::bind used define interface should used.

so sadly i'd can't controlled through api, might easier tweak @ os routing level unless you're willing modify qnetworkaccessmanager's code.

qt networking qtwebkit qnetworkaccessmanager

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -