Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] TcpServer can't work under ubuntu, but works under windows
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    billconan
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        billconan
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          billconan
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved