Community discussion forum

Quickest way to determine if a Computer is on the network [VC++6]

  • 2 years ago

    I need to find the quickest way to determine if a computer is on the network (by machine name) - currently I use RegOpenKeyEx and if the return isn't ERROR_SUCCESS then I know I can't access the station - this takes around 8 seconds for stations that are NOT on the network.

    Now, I was doing some testing today and found some odd results where RegOpenKeyEx did return ERROR_SUCCESS for stations that I am 100% sure are not on the network and that made me start thinking that this might NOT be the best approach for trying to determine if a station is on the network or not - that and 8 seconds is kind of long if I have 20 stations to check (pretty much holds my application hostage for a worst-case-scenario time of 160 seconds).

    So I was hoping someone could propose a better, more efficient, more accurate, and quicker solution.

    In reality what I need to accomplish is:
    - Every 20 minutes check all 20 systems to see if they are on the network and retrieve the value of a specific registry key on the station
    - If they are NOT on the network log the fact and continue on to the next

    Any help would be much appreciated.
    Thanks,

  • 2 years ago
    Perhaps using Winsock might help?

    You could try to open a connection and if you can't connect then you can assume it's not there. If you can, just close the connection straight away without sending data.



Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!