Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Is there any way to make webkit use specific network interface
QtWS25 Last Chance

Is there any way to make webkit use specific network interface

Scheduled Pinned Locked Moved Solved Qt WebKit
2 Posts 1 Posters 766 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • slowargoS Offline
    slowargoS Offline
    slowargo
    wrote on last edited by
    #1

    Hi all,
    I'm trying QT5 on a linux box which has multple network interfaces. I would like to use webkit to show the wifi web portal and therefore the traffic of webkit should only go through wlan instead of any other interfaces. I came up with two ideas:
    1 use iptables to redirect all packets with port 80 to wlan
    2 make wlan the default gateway
    But both of them may affect existing connections. I'm wondering is there a better way to bind webkit's sockets to the specified network interface?
    Thanks

    1 Reply Last reply
    0
    • slowargoS Offline
      slowargoS Offline
      slowargo
      wrote on last edited by slowargo
      #2

      Just figured out that the correct way is using QNetworkAccessManager:

      QNetworkConfigurationManager manager;
      QList<QNetworkConfiguration> listCfg = manager.allConfigurations();
      foreach(const QNetworkConfiguration& now, listCfg){
      	if (now.name() == strIf) {
      		ui->frameWeb->page()->networkAccessManager()->setConfiguration(now);
      		break;
      	}
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved