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 examples (client and server)
Qt 6.11 is out! See what's new in the release blog

Fortune examples (client and server)

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 3 Posters 4.2k Views 2 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.
  • D Diarby

    @mrjj Hi. Can I use a value of 0 ?

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

    @Diarby
    Hi
    That is not a good port.
    You could use some random one for the server app and clients would always try that.
    But you might be blocked by firewalls.

    D 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #10

      Hi
      https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
      Ports are normally used pr service the server provides.
      You are free to use one not taken.
      BUT can u trust the users to open ports?

      D 1 Reply Last reply
      2
      • mrjjM mrjj

        @Diarby
        Hi
        That is not a good port.
        You could use some random one for the server app and clients would always try that.
        But you might be blocked by firewalls.

        D Offline
        D Offline
        Diarby
        wrote on last edited by
        #11

        @mrjj
        Hi. I'd try to scan all ports (from 1 to 65535) until I found the exact one. For each, I'll try a connection.
        Is this solution suitable ?

        mrjjM 1 Reply Last reply
        0
        • D Diarby

          @mrjj
          Hi. I'd try to scan all ports (from 1 to 65535) until I found the exact one. For each, I'll try a connection.
          Is this solution suitable ?

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

          @Diarby
          well if user run some local webserver or other service it might not work but
          yes it could work.

          You do understand that most home routers comes with most ports disabled ?
          and wont allow access unless open in router.

          So if you deployment involves random user around the world and u try to connect to them from outside, you
          might get issues.

          1 Reply Last reply
          2
          • mrjjM mrjj

            Hi
            https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
            Ports are normally used pr service the server provides.
            You are free to use one not taken.
            BUT can u trust the users to open ports?

            D Offline
            D Offline
            Diarby
            wrote on last edited by
            #13

            @mrjj
            Thanks for this link. I was writing when you sent it. Please give me time to read it and I'll be back tomorrow

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #14

              Hi normally the users are running the client that connects to a known IP+port to talk
              to server. It sounds like you plan to do the reverse?

              D 1 Reply Last reply
              1
              • mrjjM mrjj

                Hi normally the users are running the client that connects to a known IP+port to talk
                to server. It sounds like you plan to do the reverse?

                D Offline
                D Offline
                Diarby
                wrote on last edited by
                #15

                @mrjj
                Hi
                I just finished reading the wikipedia article. From your last post, I agree to your opinion : IP + port is known by clients.
                I was disturbed by Fortune Server which changes port on every launch.
                A subsidiary question, why Qt let newbies learn client/server programming with this example ?

                VRoninV mrjjM 2 Replies Last reply
                0
                • D Diarby

                  @mrjj
                  Hi
                  I just finished reading the wikipedia article. From your last post, I agree to your opinion : IP + port is known by clients.
                  I was disturbed by Fortune Server which changes port on every launch.
                  A subsidiary question, why Qt let newbies learn client/server programming with this example ?

                  VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by VRonin
                  #16

                  @Diarby said in Fortune examples (client and server):

                  I was disturbed by Fortune Server which changes port on every launch.

                  Just change if (!tcpServer->listen()) to if (!tcpServer->listen(QHostAddress::Any,13008)) in the server then you can be 100% sure the port will be 13008

                  A subsidiary question, why Qt let newbies learn client/server programming with this example ?

                  I know, it's proper garbage.
                  Try page 323 (341 of the PDF) of C++ GUI Programming with Qt4. It's a bit old and QDataStream evolved and made everything easier but it's still better than the Fortune example

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  1 Reply Last reply
                  2
                  • D Diarby

                    @mrjj
                    Hi
                    I just finished reading the wikipedia article. From your last post, I agree to your opinion : IP + port is known by clients.
                    I was disturbed by Fortune Server which changes port on every launch.
                    A subsidiary question, why Qt let newbies learn client/server programming with this example ?

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

                    @Diarby
                    Ok, so it will not be reversed in your case?
                    The Fortune examples just teach how to use the Qt classes.
                    Its not really up to the task of teaching basic networking. ( or not included at least)
                    But there are tons of info about that on net.

                    D 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @Diarby
                      Ok, so it will not be reversed in your case?
                      The Fortune examples just teach how to use the Qt classes.
                      Its not really up to the task of teaching basic networking. ( or not included at least)
                      But there are tons of info about that on net.

                      D Offline
                      D Offline
                      Diarby
                      wrote on last edited by
                      #18

                      @mrjj
                      Hi, Thanks a lot for your help. I learn more today about programming with Qt.
                      @VRonin
                      Thanks for tips.
                      For all of you, God blesses you.

                      1 Reply Last reply
                      1

                      • Login

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