![]() |
| | #1 |
| Registered User Join Date: Feb 2005
Posts: 2
| |
| zly is offline | |
| | #2 |
| Hamster without a wheel Join Date: Aug 2001
Posts: 1,385
| You could ping the system you want to connect to. Why do you want the application to connect to the internet? Will it connect to a custom server/service or a known one?
__________________ Monday - what a way to spend a seventh of your life |
| iain is offline | |
| | #3 |
| Registered User Join Date: Feb 2005
Posts: 2
| It wonīt connect to any server. It just has to perform some stuff while user is on net. I tried this line: if(!system("ping -c 1 www.google.com")) ... //sistem is online But itīs quite unelegant (server could be crushed...) and detection is too slow. If someone know for some Linux API function or something similar, that would be great. Thanks anyway. |
| zly is offline | |
| | #4 |
| Obsessed with C Join Date: Jan 2003
Posts: 501
| Use sockets to try and make a connec()tion to an outside server. You could I guess check to see if they have everything set up for internet, but that doesn't mean it is going to work, so you will have to see if you can reach outside of the system.
__________________ Help populate a c/c++ help irc channel server: irc://irc.efnet.net channel: #c |
| chrismiceli is offline | |
| | #5 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 3,020
| Use the gethostbyname() function, and try to resolve a common domain (Like yahoo.com). If it fails, then you can conclude one of the following: 1) yahoo.com is down (unlikely) 2) Internet connection is down 3) Internet connection is up, but DNS server is down |
| bithub is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using a router, can I "dedicate" bandwith to a certain connection as needed? | indigo0086 | Tech Board | 6 | 12-19-2008 05:49 PM |
| multiple forks in one client connection (ftpclient) | Dynamo | Networking/Device Communication | 3 | 07-09-2008 02:26 PM |
| passing a connection to another process. | Kinasz | Networking/Device Communication | 3 | 10-09-2004 05:34 PM |
| Headers that use each other | nickname_changed | C++ Programming | 7 | 10-03-2003 04:25 AM |
| Detecting (internet) connection status | Coder | Windows Programming | 9 | 03-16-2002 05:14 AM |