Thread: checking for an internet connection

  1. #1
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125

    Question checking for an internet connection

    is there any way to have a console win32 program check for current internet acess?
    Last edited by canine; 09-23-2001 at 09:45 AM.

  2. #2
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    please help

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    I'm not sure, but you could always use an unreliable method: try to connect to a major website such as yahoo.com on it's port 80 (HTTP port) if it works, then you're online, so just disconnect from the port and continue merrily along with your program. If it fails then you're (most likely) not connected (I say most likely because the site could be down. Try connecting to two or three servers if the first won't work.) and you should halt the program and ask for the user to connect to the internet, then check those servers again to make sure.

    hope that helps!

  4. #4
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    sorry, but do u have any site that would tell me how to do that? i would have no idea where to start...

  5. #5
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    just look up "winsock code c" or something similar on google.

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    32
    Check out this link! Best tutorial I have ever found along the lines of WinSock. It's for C++ but I have been easily able to change the few small things that are pure C++ into C code so then I can understand it more easily. If you need help in doing likewise just give me a PM and I'd be glad to help you out

    http://www.hal-pc.org/~johnnie2/winsock.html
    cerion
    Use the code Luke.

  7. #7

    port 80 maybe a problem

    Using the methos of checking for an internet connection by connecting through a site in port 80 may be a problem. Firewalls could be unreliable and also port 80 may be in use by something other than an internet connection. I would suggest simply asking if they will allow you yo connect to the internet and if they say yes than they are bound to be connected. Otherwise if the say no they probably aren't. you could also have an options setting to record if they are using a dial-up or a lan connection to the internet because if it was dial-up you could open the dial-up connection but if lan just access it without any problems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  3. Checking for internet connection
    By ROCKaMIC in forum Networking/Device Communication
    Replies: 2
    Last Post: 11-13-2004, 09:08 AM
  4. Checking for internet connection
    By ROCKaMIC in forum C Programming
    Replies: 6
    Last Post: 11-12-2004, 10:01 AM
  5. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM