Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Extending networking/socket programming functionality of a qml project
Forum Updated to NodeBB v4.3 + New Features

Extending networking/socket programming functionality of a qml project

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
92 Posts 5 Posters 17.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.
  • jsulmJ jsulm

    @qcoderpro said in Extending networking/socket programming functionality of a qml project:

    The client also has that address (in its code) so it connects to it

    Do you mean IP address? No, client also has to get the IP first.

    "If so, how about the port number!?" - port number can be fixed (like 8080 for HTTP).

    Q Offline
    Q Offline
    qcoderpro
    wrote on last edited by
    #20

    @jsulm
    OK so both projects need to get the IP address at runtime and since the port is set to 8080 (as you said), they can connect and start exchanging messages. Right?

    jsulmJ 1 Reply Last reply
    0
    • Q qcoderpro

      @jsulm
      OK so both projects need to get the IP address at runtime and since the port is set to 8080 (as you said), they can connect and start exchanging messages. Right?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #21

      @qcoderpro said in Extending networking/socket programming functionality of a qml project:

      as you said

      I did not. It was just an example.
      "they can connect and start exchanging messages" - if they can get the IP then yes.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      1
      • jsulmJ jsulm

        @qcoderpro said in Extending networking/socket programming functionality of a qml project:

        as you said

        I did not. It was just an example.
        "they can connect and start exchanging messages" - if they can get the IP then yes.

        Q Offline
        Q Offline
        qcoderpro
        wrote on last edited by
        #22

        @jsulm

        OK I visited the page for noip.com and read a number of services they offer, some of them are free, but limited, as expected.
        Are the steps to get the IP needed for the projects to work, as below, please?

        1: Create an Account.
        2: Confirm Your Account.
        3: Log In to Your Account.
        4: Add a Host or Domain to Your Account.
        5: Making Your Host Dynamic.
        6: Configure Your Router.
        7: Run Your Services

        I signed up and then went for adding a hostname but for the domain there're many options, as follows:
        qweqw.png

        1. Is what I've done so far right, please?
        2. What to choose for the domain, please?
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #23
          1. yes
          2. that's up to you.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply
          1
          • SGaistS SGaist
            1. yes
            2. that's up to you.
            Q Offline
            Q Offline
            qcoderpro
            wrote on last edited by
            #24

            @SGaist

            1. yes

            So I need to go through all those 7 steps. Right?

            1. that's up to you.

            I've no idea what to choose and for what, ect. since I'm new in networking and my purpose for using noip service ( (for now)) is just to use it for my two QML projects mentioned above. Which domain do you suggest, please?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #25
              1. except the router step, that part you will need to do for your device.

              2. the subdomain really does not matter that much, hence your choice. The default shall be fine.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Q 1 Reply Last reply
              1
              • SGaistS SGaist
                1. except the router step, that part you will need to do for your device.

                2. the subdomain really does not matter that much, hence your choice. The default shall be fine.

                Q Offline
                Q Offline
                qcoderpro
                wrote on last edited by
                #26

                @SGaist
                I created the hostname with the default domain.
                1- But is this hostname the IP address we were aiming to get from noip!?

                For the step 5, I installed their app on my Windows and it takes my IP and point it to the hostname so that the hostname works statically as though I'm having a static IP.
                But my two apps should not rely on my machine and IP address. They may be run by two different people from different countries.
                What I need is that, that hostname acts like a bridge to connect the apps independently of the place they're running from.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #27

                  The device that runs the server shall update the record at noip to point to its own address.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • Q Offline
                    Q Offline
                    qcoderpro
                    wrote on last edited by
                    #28

                    @SGaist

                    The device that runs the server shall update the record at noip to point to its own address.

                    1- So the server, using its code, should update the record at noip to point to its own address, and then client should connect to the hostname at noip. Hence this way both apps can establish a connection. Right?

                    2- But for the server to get access to noip and update its record and the client to get connected to the address provided by noip, we need an IP address. Right? I only see my PC's IP address and my hostname on noip!
                    das123.PNG

                    3- Where's that IP address that will do the real job of the connection between the apps? I assume it should be my hostname! Wrong, please?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #29
                      1. Yes
                      2. As I already wrote, it's going to be the role of your server application to update the record at noip. You client will have the host name either hardcoded or as something that can be configured at runtime.
                      3. It's the IP address of the device that runs your server application.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Q 1 Reply Last reply
                      1
                      • SGaistS SGaist
                        1. Yes
                        2. As I already wrote, it's going to be the role of your server application to update the record at noip. You client will have the host name either hardcoded or as something that can be configured at runtime.
                        3. It's the IP address of the device that runs your server application.
                        Q Offline
                        Q Offline
                        qcoderpro
                        wrote on last edited by
                        #30

                        @SGaist

                        As I already wrote, it's going to be the role of your server application to update the record at noip.

                        I suppose it's a two-step task:

                        1- First the server (using its code) shall connect to noip. A simple connection piece of code (which is also used in my app) is: tcpSocket->connectToHost(ip, port.toInt()); So presumably an IP (and a port) is/are required for a connection. Therefore how should that server connect to noip, please?

                        2- The server then needs to update a record (of my hostname there, probably) so that the IP the server is running on will be set there. How does that update take place? I have no info of! :|

                        You client will have the host name either hardcoded or as something that can be configured at runtime.

                        3- OK, if we aim at hard coding, using what code should the client get access to the hostname, please?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #31

                          Are you realizing that your design is getting really complicated for not much benefit ?

                          1. you do realize that as soon as a mobile device (or any networked device for that matter) can access internet it already has an IP address ?
                          2. check with noip for a client library to do that.
                          3. Do you know what hardcoding a value means ? Also as a said, you can configure that value in a setting.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          Q 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Are you realizing that your design is getting really complicated for not much benefit ?

                            1. you do realize that as soon as a mobile device (or any networked device for that matter) can access internet it already has an IP address ?
                            2. check with noip for a client library to do that.
                            3. Do you know what hardcoding a value means ? Also as a said, you can configure that value in a setting.
                            Q Offline
                            Q Offline
                            qcoderpro
                            wrote on last edited by
                            #32

                            Yes, I'm seeing it. I need to wait two days for a text reply.
                            But still have liked not to give up since all the stuff are completely new for me and are interesting.

                            1. you do realize that as soon as a mobile device (or any networked device for that matter) can access internet it already has an IP address ?

                            Yes, the client app itself has an IP address but the destination it wants to connect to (the noip site) should supposedly also have an IP address. I think you don't mean to use the IP address dedicated to the website for that connection!

                            1. check with noip for a client library to do that.

                            Will try that.

                            1. Do you know what hardcoding a value means ?

                            I think it means writing code. Know nothing more about that.

                            Also as a said, you can configure that value in a setting.

                            Setting? Setting of where?

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #33

                              If you really need the noip address, then use QHostInfo.

                              Hardcoding means that you store some value within your code.

                              As for the settings, do you know what applications settings are ? Did you take a look at QSettings ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              Q 1 Reply Last reply
                              1
                              • SGaistS SGaist

                                If you really need the noip address, then use QHostInfo.

                                Hardcoding means that you store some value within your code.

                                As for the settings, do you know what applications settings are ? Did you take a look at QSettings ?

                                Q Offline
                                Q Offline
                                qcoderpro
                                wrote on last edited by
                                #34

                                @SGaist
                                I'm not sure why QSettings is needed, since as far as I know our intention is not storing something on the device the app is running on and then recalling that thing when the app reruns.
                                Yes, using QHostInfo it's possible to connect to noip or even my hostname there, but the problem is how to update the record at noip/my hostname so that the server's IP will be set there. :(

                                As well as, I contacted noip and here's our talk:

                                • Suppose I send both applications to two of my friends each in a different city. One of them runs the server app on their mobile device (using the Internet through Wifi connection) and the other guy runs the client app on their mobile device, again, connected to a Wifi.
                                  What I, as the developer, can do is to modify the code for both apps to connect to my hostname "...ns.net". But the issue is, how is it possible for the server app to update a record there (on my hostname or so) to set its IP address in a way when the client app connects to my hostname, it can read the IP address of the server there and this way establish a connection, please?
                                  What section of your website should I check for that service and use it for that goal, please?

                                • Here at No-IP we simply resolve a hostname or domain to an IP address; no data is ever passed through us nor do we issue any IP addresses. Our services does not connect your hostname to other networks unless you configure your hostname there. Best practices are 1 hostname per network location. You will not be able to set a single hostname for 2 or more locations. If you wish to connect to your friends server app, the hostname must be configured on their network in an update client to send out the current public IP address from that network. An update client can be either a router, a DDNS capable device, or the DUC that can be downloaded from your No-IP account.

                                Still I'm confused. :(

                                1 Reply Last reply
                                0
                                • Q Offline
                                  Q Offline
                                  qcoderpro
                                  wrote on last edited by
                                  #35

                                  Can't anyone help me how to work the main issue out, please?
                                  I believe the main issue is how to set the IP address of the server app on the noip website or my hostname to make it possible for the client app to get access to the server app and establish a connection.

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #36

                                    The main issue is that you currently do not understand properly how networking works.

                                    As already written, your device automatically gets an IP address as soon as it is properly connected to a network be it WiFi, 4G/5G etc.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    Q 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      The main issue is that you currently do not understand properly how networking works.

                                      As already written, your device automatically gets an IP address as soon as it is properly connected to a network be it WiFi, 4G/5G etc.

                                      Q Offline
                                      Q Offline
                                      qcoderpro
                                      wrote on last edited by
                                      #37

                                      @SGaist

                                      I understand this. Suppose the server app is running on a device with IP: 123.456.789
                                      To give that address to the client app, you suggested noip. OK, I signed up and added a hostname too and posted my last talk with them above. Now the main issue is giving that address to the client app or as you say: updating a record on noip. How to do that? This is my problem.

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #38

                                        The client uses the host name that's all from its side.

                                        You server needs to implement the client part that updates the noip record. Take a look at their client to implement that.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        Q 1 Reply Last reply
                                        1
                                        • SGaistS SGaist

                                          The client uses the host name that's all from its side.

                                          You server needs to implement the client part that updates the noip record. Take a look at their client to implement that.

                                          Q Offline
                                          Q Offline
                                          qcoderpro
                                          wrote on last edited by
                                          #39

                                          @SGaist

                                          The client uses the host name that's all from its side.

                                          The client connects to the hostname and gets its IP address. The IP of the hostname (I mean the one I added, "..dev.ddns.net") for example, is, 123.456.789, so the client now owns this address. Right?

                                          You server needs to implement the client part that updates the noip record.

                                          Does this mean that the server also needs to connect to the hostname above and gets that IP address!?

                                          Take a look at their client to implement that.

                                          Could you give me the address of that part, please?

                                          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