[solved] TcpServer can't work under ubuntu, but works under windows



  • Hello,

    I'm trying to create a tcp server. The same code works fine under windows. But under linux, I can't connect at all.

    I'm listening QHostAddress::Any, port = 8080. If I type http://localhost:8080/ inside a web browser, the incomingConnection(int socket) function of the class QTcpServer never gets called under. And the connection takes forever.

    Do you know what the problem might be?



  • Iptables firewall, something else running on port 8080, ..., your code. Care to share?



  • my code is very similar to the tcpserver example.

    I have used netstat -lnptu command to check port usage. I didn't see 8080 being used.



  • I have solved the issue. The reason is that the interface of incomming function has changed.
    My project stated with Qt4.8 and recently moved to Qt5.

    the incomming function has changed from
    void HttpServer::incomingConnection(int)
    to
    void HttpServer::incomingConnection(qintptr handle)

    it's not a problem under windows, but under linux, the it never gets called.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.