PDA

View Full Version : QTcpSocket + Windows



greenvirag
10th January 2009, 14:19
Hi all!

I'm new to socket programming on windows.
I made a client application working on linux using qtcpsocket, and it workd perfectly.

I compiled it on windows, but it doesn't connect. Acutally, it might not try to connect.
So, nothing happen. What should I do? Where is the problem.
I found nothing relevant on the internet.

The connection:


void sudoku::on_connectButton_clicked()
{
if( connected == false )
{
tcpSocket->abort();
tcpSocket->connectToHost(host,port);
ui.sendButton->setEnabled(true);
ui.connectButton->setText(QString("Disconnect"));
connected = true;
}
else
{
tcpSocket->abort();
ui.sendButton->setEnabled(false);
ui.connectButton->setText(QString("Connect"));
connected = false;
}

}

wysota
10th January 2009, 14:40
Maybe a firewall is blocking the connection?

By the way, calling connectToHost() doesn't mean the socket is immediately connected. This is an asynchronous call, remember that. It only means the application is currently TRYING to connect.

greenvirag
19th January 2009, 16:04
Thanks, I ckecked it, but no effect.

One day later with a newer program at server side, it works!
Firewall doesn't matter. I don't know, what was the reason..