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 get all IP address on a LAN ?
QtWS25 Last Chance

How to get all IP address on a LAN ?

Scheduled Pinned Locked Moved General and Desktop
12 Posts 6 Posters 14.2k 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
    Berton
    wrote on 30 Dec 2011, 10:52 last edited by
    #1

    I have no idea how to get all IP address on a LAN.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 30 Dec 2011, 10:57 last edited by
      #2

      Welcome to devnet forum

      Probably you may have to elaborate a bit more what you are trying to do.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Berton
        wrote on 30 Dec 2011, 11:19 last edited by
        #3

        Sorry, I want to get a list of IP address of all computers connected to a same lan. But I don't know what method I can use in Qt.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on 30 Dec 2011, 11:24 last edited by
          #4

          AFAIK there is no support of Qt for your task. I would assume that you require the support of your LAN access point for providing all IP addresses. For instance a router modem may tell you all IP addresses connected.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Berton
            wrote on 30 Dec 2011, 11:36 last edited by
            #5

            thanks. may be i need to find a alternative method to fix it.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fluca1978
              wrote on 30 Dec 2011, 11:49 last edited by
              #6

              There is no sure way to achieve it. If computers are in DHCP you have to deal with the DHCP server to get the assigned addresses, but someone could have used a fixed ip address or could have disconnected before the lease expired. You can try to ping a broadcast, but someone could not reply to the ping. The only solution is to rely on a service on each machine announcing to you or that you can poll.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aureshinite
                wrote on 1 Jan 2012, 23:11 last edited by
                #7

                You can use ARP , which is what computers in the same subnetwork use to communicate.
                Follow "These instructions":http://www.windowsitpro.com/article/monitoring-and-analysis/how-can-i-get-a-list-of-mac-to-ip-addresses-on-the-network to see how it work, but if you want to do it using Qt, you need to create thes packets yourself. Or you can wrap call the script on each OS to get something portable.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fluca1978
                  wrote on 2 Jan 2012, 07:23 last edited by
                  #8

                  [quote author="aureshinite" date="1325459482"]You can use ARP [/quote]

                  Arp will work as a cache, so it is not safe either to query via arp other network cards.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    aureshinite
                    wrote on 2 Jan 2012, 20:19 last edited by
                    #9

                    [quote author="fluca1978" date="1325489013"]

                    Arp will work as a cache, so it is not safe

                    [/quote]

                    Can you explain me how it is not safe?

                    If there is a functioning and trusted (ie it doesn't send garbage) computer in your LAN, then you can definitely see its address in the ARP cache. The article use ping as a fast way of using it, but ARP itself has multiple way of finding hosts. For example an ARP probe which is usually for testing address conflict can be use. You send it, and you just need to collect hosts details from packets responses. Note that this can also be done from the ping to the broadcast address.

                    At the length of my knowledge, DHCP is only use between a client and DHCP servers. It cannot obtain information about other clients using DHCP protocol.

                    The idea is : You need to use broadcast in some way. Either with ping, either with ARP. Not with DHCP.

                    One thing : a router never retransmit an ARP outside his sub-network. So if your network has an hierarchy of routers, use ping.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on 2 Jan 2012, 22:14 last edited by
                      #10

                      There is no reliable way to determine all hosts in a LAN. Point.

                      There are many means of guessing your neighbors, each with its own advantages and drawbacks. But you will never be sure you get all hosts.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        fluca1978
                        wrote on 3 Jan 2012, 07:15 last edited by
                        #11

                        A dhcp server knows assigned addresses. The problem is the host could have been disappeared before the lease expires or it could have a static address. In both cases, the dhcp server will not know enough about the client.
                        An arp discovering is much more complicated than a ping broadcast. None is more sure than the other, since an host can avoid replying a ping or can use arp poisoning.
                        If you pass a router you are outside your network, so there is no advantage in using ping with respect to arp. Moreover, each time you pass a router you are calling for other troubles, since the router could also filter packets.
                        As I said in my previous post, and as Volker stated, there is no way to discover hosts on a network. Or better, the only way is to sniff traffic thru a mirrored port over a switch.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          salin
                          wrote on 22 Aug 2013, 04:09 last edited by
                          #12

                          You can find out the Ip address of your connection and not the ip address of all computers connected through the same LAN...I can provide you with some tips to find your IP address..

                          Press the Windows key and R button at the same time

                          Type cmd in the run tab which is opened and press OK

                          Type ipconfig in the command prompt dialog box

                          Press enter

                          It will show your ip address of your computer...After knowing your Ip address you can visit "Ip-details.com":http://www.ip-details.com to check your Ip address...

                          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