Qt-interest Archive, February 2008
Re: Trivial QTcpServer does not listen to port
Message 1 in thread
Solved.
QHostAddress(QHostAddress::Any) instead of QHostAddress("127.0.0.1");
On Thu, Jan 31, 2008 at 5:13 PM, Flávio Luis de Mello <
flavioluis.mello@xxxxxxxxx> wrote:
> QT4.3.1 + VC6
>
> Hi there,
>
> I am trying to reproduce the Threaded Fortune Server from QT demo on my
> application, but I can't understand what is going wrong. I have created a
> "class CWittyServer : public QTcpServer", which is an exact copy from QT
> demo "class FortuneServer : public QTcpServer" . There is no change at all.
> Then I do the following:
>
> TcpServer = new CWittyServer();
> QHostAddress hostAddress = QHostAddress("127.0.0.1");
> if(TcpServer->listen(hostAddress,piPort))
> qDebug("ok");
> else
> qDebug("not ok");
>
> piPort = 5300, but it can be any other. I get the "ok" debug message,
> although it doesn't look like a running server. First, Windows Firewall (ok,
> some jokes are acceptable) doesn't gives any warn about the running service.
> The Threaded Fortune Server does. Second it doesn't reposnd to the QT Demo
> Fortune Client. Third, I try to start an MySQL server on the same port, just
> for testing, and it says thar the port is busy. Does any one can give me a
> tip of what it is going wrong?
>
> Thanks in advance,
>
> Flávio Mello
>
>
>