Thread: 2 problems

  1. #1
    Registered User
    Join Date
    Jan 2002

    2 problems

    i'm not asking for the programs, just where to find specific information.

    Heres a little info first, the program will run on a server. The network has 50+ pc's and internet access is through 2 isdn lines through a router.

    1. How can i programmatically check for an internet connection.
    does pinging tell me this and how to incorporate that in a program.

    2. if a net connection is not present, i need to telnet into the router and control the maintenance program via a program, then forcing the lines to recconect (if i can control the maintenace program this is simply an option), the maintenance program is console based and uses menus (accessed via corresponding numbers). Totally not sure how to do this.

    Surely this has been done before to automate control of the internet connection.

    Where can i find information on this.

    (I know i asked similar questions before but i have included far more detail this time round.)

  2. #2
    Registered User dizolve's Avatar
    Join Date
    Dec 2002
    1. No, pinging does a local loop and will not tell you if you have internet access. I'm not really sure how you can do this, I'd have to think about it.

    2. You can open telnet using popen() and then use the descriptor just like you would a file to send commands and receive text.

  3. #3
    I would just ping a well known site like
    My Avatar says: "Stay in School"

    Rocco is the Boy!

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    > I would just ping a well known site like

    What if that site's down (I know it's unlikely, but it's possible)?

    How about if you pinged yourself (your actual internet IP, not some private network IP)


  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Göteborg, Sweden
    My personal programs pings my ISP.

    I'd suggest that you ping (99.999% uptime), and if that site is down, try (high uptime).
    For even more accuracy, try more servers (at different physical locations).
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    Registered User
    Join Date
    Jan 2002
    Yeah, fair enough i can ping servers.

    What i want though is to be able to do this via a program, i don't want to do anything manually, how can i write a program that can ping a server and then report to itself whether or not it has been successful.

    I'm sure there are programs out there that check for a net connection in a better way than to ping microsoft.

    Thanks for your replies so far guys.

  7. #7
    Registered User
    Join Date
    Apr 2002
    I would suggest looking into SNMP, it is the perfect solution to your problem.

    The best set of libraries to use is NET-SNMP ( formaly UCD-SNMP ).

    This should allow you to get information from your router that tells you if the internet connection ( interface BRI 0 for instance ) is up, and how many packets it has routed and to what interface.

    Good luck with your programming.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 05:35 AM
  3. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 04:48 PM
  4. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  5. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 08:19 PM