t-artistik / qtscriptgenerator

Automatically exported from code.google.com/p/qtscriptgenerator
0 stars 0 forks source link

QTcpSocket.connectToHost doesn't work #65

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The follow code results in a "function not found match". 
var host = new QHostAddress("localhost");
var sock = new QTcpSocket();
var port = 25;
sock.connectToHost(host, port, QIODevice.ReadWrite);

It appears that its expecting a quint16, and fails when it doesn't receive one?

Note: this is a repost of issue #29 which was supposed to be fixed but it
is not (not in stable and not in the latest GIT version).

Original issue reported on code.google.com by cyberwizzard on 28 Dec 2009 at 7:35

GoogleCodeExporter commented 8 years ago
Hi, I have exactly the same problem! Using latest Amarok and its scripting 
engine, I cant connect using QTcpSocket.

executing this code:

var sock = new QTcpSocket(this);
var addr = QHostInfo.fromName("www.google.com").addresses();
var haddress = new QHostAddress(addr[0]);
sock.connectToHost(haddress, 80, QIODevice.ReadWrite);

gives this error:
Error: QAbstractSocket::connectToHost(): could not find a function match; 
candidates are:
connectToHost(QHostAddress address, unsigned short port, OpenMode mode)
connectToHost(String hostName, unsigned short port, OpenMode mode)

I wouldn't even try using sockets, but I need to send custom headers, so 
Downloader can't be used. It appears that I can't even do that using the 
QNetworkRequest because setRawHeader() does exactly nothing! But that's another 
issue which I'm gonna post now..

Original comment by cotko...@gmail.com on 25 Dec 2010 at 9:03