Thread: Network Location

  1. #1
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    Network Location

    Hey,

    I am writing a backup program for my network that will run on startup, and copy files from one pc to a location on the server pc.

    Before i copy the files though i need to see if the server is presently connected to the network or if it is simply turned off.

    So baically i need help on finding out if a pc is connected to the network, i would like to find out by using its network name in this case 'h-server'. Or if i cant do this then i can use its IP. I did think about using ping from my prog and seeing what the output was but i thought this would be taking the long way round...

    Thanks for any help,
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  2. #2
    ‡ †hë Ö†hÈr sîÐè ‡ Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    The only way I know of to see if a host is online is to use ping.
    If the host is down you could set your program to ping the host at intervals to perform whatever its backup routines as soon as the host is visible.
    sry I couldn't be anymore help
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Can you use gethostbyname() or gethostbyaddr() and look for a NULL return?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3D Network Analysis Tool
    By durban in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 11-08-2005, 06:33 PM
  2. instantiated from here: errors...
    By advocation in forum C++ Programming
    Replies: 5
    Last Post: 03-27-2005, 09:01 AM
  3. I need help with templates!
    By advocation in forum C++ Programming
    Replies: 6
    Last Post: 03-26-2005, 09:27 PM
  4. network problems
    By lucy in forum Tech Board
    Replies: 6
    Last Post: 01-01-2003, 03:33 PM
  5. Im so lost at . .
    By hermit in forum C Programming
    Replies: 18
    Last Post: 05-15-2002, 01:26 AM