In the same PC, I have a wired and wireless network device (in Kubuntu 13.04), eth0 and wlan0, both with different IPs on the same subnet. I have a QTcpServer on each of them on different ports. The listen on wlan0 uses wlan0’s IP (eg 192.168.13.193) and the listen on eth0 uses eth0’s IP (eg 192.168.13.102).
QNetworkInterface wlan0 = QNetworkInterface::interfaceFromName("wlan0");
tcpServer = new QTcpServer(this);
tcpServer->listen(wlan0.addressEntries().first().ip(), 12346);
connect(tcpServer, SIGNAL(newConnection()), this, SLOT(link()));
..link() slot
tcp_client = tcpServer->nextPendingConnection();
From another linux machine on the same subnet, I make two client connections
socat tcp:192.168.13.102:12345 –
socat tcp:192.168.13.193:12346 –
after which I do a tcp_client->write(a bunch of data); …using the tcp_client associated to the wlan0 interface. The problem is that the data goes over eth0 instead of wlan0. I need to test that the wlan0 interface is working correctly. I suspect this isn’t possible to control from the application and I may need to change my routing at the OS level. Can anyone confirm?
↧