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. Fortune Server/Client Example does not work remote

Fortune Server/Client Example does not work remote

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 2.4k Views
  • 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.
  • Q Offline
    Q Offline
    qmmj
    wrote on last edited by
    #1

    Hello,

    I want to control a GUI running on a Raspberry PI remotely from a computer connected via local ethernet link.
    I found the fortune server / fortune client examples from the Qt Network module.

    This example is running nice as long as I'm running the server and the client on the same host (Laptop (Qt 5.7.1 amd64 GNU/Linux) or Raspbian (Qt 5.3.2 armhf Linux)). If I try to connect from one host to the other, I receive no fortune. If the IP or the port is invalid, I receive a error. If both are valid there is just no fortune.

    Is there a bug, or do I have to adapt the example for my purpose?

    Is this example a good starting point for implementing a fast and simple signaling between two local linked hosts?

    Thanks for your suggestions.

    1 Reply Last reply
    0
    • vishnuV Offline
      vishnuV Offline
      vishnu
      wrote on last edited by
      #2

      @qmmj
      Did you check the TCP connection between the server(windows ) and client(raspberry)?

      1. I would recommend first try with ping command. Make sure that both are connected
      2. No more firewall blocks.
      3. Try to debug with wireshark. To know where the packet is going.

      The example should work.

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        qmmj
        wrote on last edited by
        #3

        @vishnu
        There should no firewalls be running. On my Laptop no firewall is set up and also on the Raspberry PI there is no firewall set up by default.
        I'm connecting to the Raspberry via VNC, so there is a link for sure.
        So I can't imaging that packets could be blocked. Nevertheless I will try to investigate wireshark.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qmmj
          wrote on last edited by
          #4

          Hmm,

          as soon I send a single first request, the data packages are going back and forth and fortunes are send (monitoring at the server host). As soon I'm closing the server, I get some errors and the client takes note and shows a connection error.
          Therefore I assume, that the client does not handle the received data correctly.

          1 Reply Last reply
          0
          • vishnuV Offline
            vishnuV Offline
            vishnu
            wrote on last edited by
            #5

            which means there is a connection problem.
            Try to bebug it.

            1. after tcpSocket->connectToHost(hostCombo->currentText(),
              portLineEdit->text().toInt())
              check if the connection is success or not

            2. check emit readyRead() signal is emitted or not by connecting it to a slot.

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qmmj
              wrote on last edited by
              #6

              Hi vishnu,

              I investigated the issue: the examples from Qt 5.3.2 and Qt 5.7.1 are not compatible. If I run the 5.3.2 example on both hosts, it works. I have not checked with the 5.7.1 example, as it relies on new calls.

              mrjjM 1 Reply Last reply
              0
              • Q qmmj

                Hi vishnu,

                I investigated the issue: the examples from Qt 5.3.2 and Qt 5.7.1 are not compatible. If I run the 5.3.2 example on both hosts, it works. I have not checked with the 5.7.1 example, as it relies on new calls.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @qmmj
                Hi
                Purely speculation but
                If you mix Qt 5.3 and 5.7
                Maybe its related to
                http://doc.qt.io/qt-5/qdatastream.html#versioning
                Didnt check if qdatastream is involved in the fortune examples :)

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qmmj
                  wrote on last edited by
                  #8

                  @mrjj:
                  in each cases setVersion(QDataStream::Qt_4_0); is called. This is not the difference. I realized with wireshark, that there is a different amount of data bytes before the characters are starting (4 resp. 6 bytes), but I have not investigated this further.

                  mrjjM 1 Reply Last reply
                  1
                  • Q Offline
                    Q Offline
                    qmmj
                    wrote on last edited by
                    #9

                    @mrjj:
                    in the Qt 5.3.2 version the data is headered by a (quint16)0; and trailed by (quint16)(block.size() - sizeof(quint16));. This bytes are removed in the Qt 5.7 version with the introduction of the startTransaction() method in 5.7.

                    1 Reply Last reply
                    0
                    • Q qmmj

                      @mrjj:
                      in each cases setVersion(QDataStream::Qt_4_0); is called. This is not the difference. I realized with wireshark, that there is a different amount of data bytes before the characters are starting (4 resp. 6 bytes), but I have not investigated this further.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @qmmj
                      Ok. was just a thought. I was bitten mixing at one point but seems to use the same version so you already checked this.

                      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