int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
setsocketoption(s, SOL_SOCKET, SO_BINDTODEVICE, intf, intf.length() + 1);
QUrl url
("192.168.0.10");
http->setSocket(qSocket);
http
->setHost
(url.
host(),
QHttp::ConnectionModeHttp, 8080u
);
header.setValue("Host", url.host());
// set other values for header here
http->request(header, 0, buffer);
QString intf = "eth0.1";
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
setsocketoption(s, SOL_SOCKET, SO_BINDTODEVICE, intf, intf.length() + 1);
QTcpSocket* qSocket = new QTcpSocket(parent);
qSocket->setSocketDescriptor(s, QAbstractSocket::BoundState);
QUrl url("192.168.0.10");
QHttp* http = new QHttp;
http->setSocket(qSocket);
http->setHost(url.host(), QHttp::ConnectionModeHttp, 8080u);
QBuffer* buffer = new QBuffer;
QHttpRequestHeader header("GET", url.path());
header.setValue("Host", url.host());
// set other values for header here
http->request(header, 0, buffer);
To copy to clipboard, switch view to plain text mode
Bookmarks