I think you need to wait for a connection to be established before starting to send data.
(either by attaching to signals or by using QAbstractSocket::waitForConnected())
client->connectToHost( tr("messenger.hotmail.com"), 1863 );
if (!client->waitForConnected()) // not good if in GUI thread, use signals then
{
qDebug() << "connection failed";
return false;
}
client->write( "VER 0 MSNP8 MSNP7 MSNP6 MSNP5", strlen("VER 0 MSNP8 MSNP7 MSNP6 MSNP5") );
QTcpSocket *client = new QTcpSocket();
client->connectToHost( tr("messenger.hotmail.com"), 1863 );
if (!client->waitForConnected()) // not good if in GUI thread, use signals then
{
qDebug() << "connection failed";
return false;
}
client->write( "VER 0 MSNP8 MSNP7 MSNP6 MSNP5", strlen("VER 0 MSNP8 MSNP7 MSNP6 MSNP5") );
To copy to clipboard, switch view to plain text mode
HTH
PS: I doubt it is necessary to tr() wrap the server url.
PPS: Note you can use a QTextStream for writing to that socket:
out << "VER 0 MSNP8 MSNP7 MSNP6 MSNP5"
QTextStream out(client);
out << "VER 0 MSNP8 MSNP7 MSNP6 MSNP5"
To copy to clipboard, switch view to plain text mode
Bookmarks