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. [SOLVED] list of all computers in local network (windows)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] list of all computers in local network (windows)

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 7.5k Views 1 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.
  • W Offline
    W Offline
    ws22
    wrote on 2 May 2014, 09:22 last edited by
    #1

    hello,
    im trying o get a list of all computers in local network. I´m on windows. I cant find a way to do that.
    Any idears?
    Thanks in advance!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jeroentjehome
      wrote on 2 May 2014, 09:30 last edited by
      #2

      Hi,
      I'm guessing that you use TCP/IP v4 network as LAN?
      Then this might be something for you:

      Docs: If you pass a literal IP address to name instead of a host name, QHostInfo will search for the domain name for the IP (i.e., QHostInfo will perform a reverse lookup). On success, the resulting QHostInfo will contain both the resolved domain name and IP addresses for the host name. Example:
      @QHostInfo::lookupHost("4.2.2.1",
      this, SLOT(lookedUp(QHostInfo)));@
      Simply loop around every possible IP adres within your LAN and you're done.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • W Offline
        W Offline
        ws22
        wrote on 2 May 2014, 09:43 last edited by
        #3

        Hello,
        Thanks for your reply!
        I already tried that already and yes, it works. B U T :
        it is very very slow. i have to wait several minutes until it´s finished.
        it there a faster alternative?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mrdebug
          wrote on 2 May 2014, 10:04 last edited by
          #4

          Why you don't use the ipscan approach?
          You have to scan each ip of your subnet and, for each ip, look if there are ports open.

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          1 Reply Last reply
          0
          • W Offline
            W Offline
            ws22
            wrote on 2 May 2014, 10:40 last edited by
            #5

            Here some code:
            I search for every adress in my network.
            do you that mean with ipscan?

            It works, but very very slow.
            it takes minutes!

            QString network = "130.17.40.";

                    for(int i=0;i<255;i++)
                    {
                        QString currIp = (network+"%1").arg(i);
                        qDebug() << "CURR IP: " << currIp;
            

            // QHostInfo::lookupHost(currIp,
            // this, SLOT(lookedUp(QHostInfo)));
            QHostInfo HI = QHostInfo::fromName(currIp);
            qDebug() << "NAME: "<< HI.hostName();
            }

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrdebug
              wrote on 2 May 2014, 10:47 last edited by
              #6

              Please, search for ipscan.exe and look at how this program works.
              You have to use threads to scan fast and simultaneous.

              Need programmers to hire?
              www.labcsp.com
              www.denisgottardello.it
              GMT+1
              Skype: mrdebug

              1 Reply Last reply
              0
              • W Offline
                W Offline
                ws22
                wrote on 2 May 2014, 11:28 last edited by
                #7

                ok, thanks.
                I`ll search for this!

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Jeroentjehome
                  wrote on 2 May 2014, 12:02 last edited by
                  #8

                  You might need the QtConcurrent class to handle multiple short threads and add signals if an used IP was found. Then you're able to fast scan all IP's in your LAN.

                  Greetz, Jeroen

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    ws22
                    wrote on 2 May 2014, 13:14 last edited by
                    #9

                    Great! This might be the solution! Thanks!

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      Jeroentjehome
                      wrote on 5 May 2014, 08:27 last edited by
                      #10

                      Hi,
                      Please place [SOLVED] before your first post. Keeps us from reading unneeded and others for finding a solution to there problem.

                      Greetz, Jeroen

                      1 Reply Last reply
                      0

                      6/10

                      2 May 2014, 10:47

                      • Login

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