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. How to discovery devices maybe in different net segment via UDP
Forum Update on Monday, May 27th 2025

How to discovery devices maybe in different net segment via UDP

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 3.1k 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.
  • B Offline
    B Offline
    brucezcg
    wrote on 26 Jun 2018, 05:11 last edited by brucezcg
    #1

    I had A PC and some devices connected to router, but I don't know the IP address of each device, May be not same net segment as my PC.
    So how can I discovery all devices please?

    I tried UDP broadcast, But if not same net segment, I cannot communicate with device via UDP.

    J 1 Reply Last reply 26 Jun 2018, 05:16
    0
    • B brucezcg
      26 Jun 2018, 05:11

      I had A PC and some devices connected to router, but I don't know the IP address of each device, May be not same net segment as my PC.
      So how can I discovery all devices please?

      I tried UDP broadcast, But if not same net segment, I cannot communicate with device via UDP.

      J Offline
      J Offline
      JKSH
      Moderators
      wrote on 26 Jun 2018, 05:16 last edited by
      #2

      https://stackoverflow.com/questions/379015/udp-broadcast-packets-across-subnets

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2
      • B Offline
        B Offline
        brucezcg
        wrote on 26 Jun 2018, 06:50 last edited by
        #3

        Thanks.
        As UDP may be require router configure carefully, Is there other way to reslove this kind of problem.

        R 1 Reply Last reply 26 Jun 2018, 06:53
        0
        • B brucezcg
          26 Jun 2018, 06:50

          Thanks.
          As UDP may be require router configure carefully, Is there other way to reslove this kind of problem.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 26 Jun 2018, 06:53 last edited by
          #4

          @brucezcg
          i dont quite understand what you want to achieve.
          There is a reason why there is something like the subnet concept. It's intention exactly is that machines don't see each other across subnets!

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          B 1 Reply Last reply 26 Jun 2018, 07:23
          5
          • R raven-worx
            26 Jun 2018, 06:53

            @brucezcg
            i dont quite understand what you want to achieve.
            There is a reason why there is something like the subnet concept. It's intention exactly is that machines don't see each other across subnets!

            B Offline
            B Offline
            brucezcg
            wrote on 26 Jun 2018, 07:23 last edited by
            #5

            @raven-worx : Thanks.

            I have many devices (Smart Cameras) connected to my router, each camera have isolate IP address. I run my Application on my PC, In order to connect each camera, First I should Discovery all cameras connected to router. but may be cameras in different subnet.
            So If the camera IP:192.168.11.11
            My PC's IP:199.55.55.44

            How can I discovery the camera from my PC?

            R J 3 Replies Last reply 26 Jun 2018, 07:40
            0
            • B brucezcg
              26 Jun 2018, 07:23

              @raven-worx : Thanks.

              I have many devices (Smart Cameras) connected to my router, each camera have isolate IP address. I run my Application on my PC, In order to connect each camera, First I should Discovery all cameras connected to router. but may be cameras in different subnet.
              So If the camera IP:192.168.11.11
              My PC's IP:199.55.55.44

              How can I discovery the camera from my PC?

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 26 Jun 2018, 07:40 last edited by raven-worx
              #6

              @brucezcg
              why are they in a different subnet in the first place?!
              Are they connected to the same router? Don't they get their IPs from the same DHCP?

              I don't see any chance getting them accessible, when the subnet mask prevents it.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              B 1 Reply Last reply 27 Jun 2018, 01:25
              2
              • B brucezcg
                26 Jun 2018, 07:23

                @raven-worx : Thanks.

                I have many devices (Smart Cameras) connected to my router, each camera have isolate IP address. I run my Application on my PC, In order to connect each camera, First I should Discovery all cameras connected to router. but may be cameras in different subnet.
                So If the camera IP:192.168.11.11
                My PC's IP:199.55.55.44

                How can I discovery the camera from my PC?

                J Offline
                J Offline
                JKSH
                Moderators
                wrote on 26 Jun 2018, 07:50 last edited by
                #7

                @brucezcg said in How to discovery devices maybe in different net segment via UDP:

                I have many devices (Smart Cameras) connected to my router, each camera have isolate IP address.... but may be cameras in different subnet.

                You should put all cameras and your PC on the same subnet. Usually, people give all devices Static IP addresses OR they enable DHCP (like @raven-worx said). With DHCP, your router automatically puts all cameras and your PC on the same subnet.

                How can I discovery the camera from my PC?

                If they are on different subnets, then you probably cannot discover them.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                3
                • B brucezcg
                  26 Jun 2018, 07:23

                  @raven-worx : Thanks.

                  I have many devices (Smart Cameras) connected to my router, each camera have isolate IP address. I run my Application on my PC, In order to connect each camera, First I should Discovery all cameras connected to router. but may be cameras in different subnet.
                  So If the camera IP:192.168.11.11
                  My PC's IP:199.55.55.44

                  How can I discovery the camera from my PC?

                  R Offline
                  R Offline
                  raven-worx
                  Moderators
                  wrote on 26 Jun 2018, 08:25 last edited by
                  #8

                  @brucezcg said in How to discovery devices maybe in different net segment via UDP:

                  My PC's IP:199.55.55.44

                  btw this IP isn't even in the private IP range. So why has your PC such an IP address assigned?!

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  1
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 26 Jun 2018, 20:26 last edited by
                    #9

                    Hi,

                    To add to my fellow, are you camera using zeroconf or something similar to advertise their presence ?

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

                    B 1 Reply Last reply 27 Jun 2018, 00:51
                    0
                    • SGaistS SGaist
                      26 Jun 2018, 20:26

                      Hi,

                      To add to my fellow, are you camera using zeroconf or something similar to advertise their presence ?

                      B Offline
                      B Offline
                      brucezcg
                      wrote on 27 Jun 2018, 00:51 last edited by
                      #10

                      @SGaist The camera will not inform its exist. they work alone, so I want to use UDP/ARP to discover them

                      1 Reply Last reply
                      0
                      • R raven-worx
                        26 Jun 2018, 07:40

                        @brucezcg
                        why are they in a different subnet in the first place?!
                        Are they connected to the same router? Don't they get their IPs from the same DHCP?

                        I don't see any chance getting them accessible, when the subnet mask prevents it.

                        B Offline
                        B Offline
                        brucezcg
                        wrote on 27 Jun 2018, 01:25 last edited by
                        #11

                        @raven-worx The camera may be work in static IP address mode, so If someone change the IP to different subnet, How can I know?

                        R 1 Reply Last reply 27 Jun 2018, 06:24
                        0
                        • B brucezcg
                          27 Jun 2018, 01:25

                          @raven-worx The camera may be work in static IP address mode, so If someone change the IP to different subnet, How can I know?

                          R Offline
                          R Offline
                          raven-worx
                          Moderators
                          wrote on 27 Jun 2018, 06:24 last edited by raven-worx
                          #12

                          @brucezcg said in How to discovery devices maybe in different net segment via UDP:

                          The camera may be work in static IP address mode, so If someone change the IP to different subnet, How can I know?

                          as i said. if they are configured to be in a different subnet you won't have a chance to discover them, because only devices in the same subnet. The subnet range is determined by the subnet mask.

                          You want to use UDP to discover them. Do you even know if they would respond to your UDP request?
                          I mean do you know for sure that the camera lets it self discover by listening to a UDP network request - provides a service to do so?

                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                          If you have a question please use the forum so others can benefit from the solution in the future

                          1 Reply Last reply
                          5
                          • B Offline
                            B Offline
                            brucezcg
                            wrote on 20 Jul 2018, 07:37 last edited by
                            #13

                            Is there any good ideas?

                            1 Reply Last reply
                            0
                            • VRoninV Offline
                              VRoninV Offline
                              VRonin
                              wrote on 20 Jul 2018, 08:10 last edited by
                              #14

                              The standard way is a known central location. A "server" (using the term very loosely here) that both cameras and PCs know about. Cameras will connect to it and tell it their IP, PC will connect to it to retrieve the list of registered cameras

                              "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
                              1

                              • Login

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