Click here to Skip to main content
15,884,177 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Connectivity test Pin
Dan Neely10-Feb-12 13:00
Dan Neely10-Feb-12 13:00 
GeneralRe: Connectivity test Pin
VallarasuS2-Feb-12 0:50
VallarasuS2-Feb-12 0:50 
GeneralRe: Connectivity test Pin
kmoorevs2-Feb-12 4:05
kmoorevs2-Feb-12 4:05 
GeneralRe: Connectivity test Pin
Gary Wheeler2-Feb-12 0:19
Gary Wheeler2-Feb-12 0:19 
GeneralRe: Connectivity test Pin
patbob2-Feb-12 6:13
patbob2-Feb-12 6:13 
GeneralRe: Connectivity test Pin
sergiogarcianinja2-Feb-12 2:12
sergiogarcianinja2-Feb-12 2:12 
GeneralRe: Connectivity test Pin
User 48350472-Feb-12 3:23
User 48350472-Feb-12 3:23 
GeneralRe: Connectivity test Pin
Theraot2-Feb-12 5:18
Theraot2-Feb-12 5:18 
If the only solution is to check for a web, check for internic.net if internic.net fails then it is as good as the end of the (internet) world.

I have made a web search to the subject and there are examples taking the same approach you describe. Sure there are APIs to test for network connection.

Then again what exactly do we call Internet? (in particular with ACTA around the corner). It may be better idea to identify the ISP server address and check for that, then again there is the risk of a broken suboceanic cable or a satelite failure... although I understand that USA will probably not notice that, I'm not in USA. You could check for some national, institutional .gov website, until it got attacked with denial of service.

By the way, will that software work properly in china or under other government firewall that decides that google is no good? Allow be to doubt it (there is always the risk that another party will use that name, and "poison" the DNS... may be on government's behalf).

Talking about DNS, you could have a host files, or local DNS server that says that google is localhost, and the same goes for internic.net. Which is good, because you may want to mock Internet for testing (and survive the so claimed Maya's predictions).

The best solution is not to test for Internet, but test for what you need on Internet, for example microsoft products will check for microsoft.com, not because their developers think microsoft.com is the Internet, but because it is the part of the Internet they need to work. For the case of P2P or similar solutions don't even test, let the connection fail.
GeneralRe: Connectivity test PinPopular
Moshe Katz2-Feb-12 7:13
Moshe Katz2-Feb-12 7:13 
GeneralRe: Connectivity test Pin
MatthysDT2-Feb-12 19:24
MatthysDT2-Feb-12 19:24 
GeneralRe: Connectivity test Pin
RCoate5-Feb-12 16:41
RCoate5-Feb-12 16:41 
GeneralRe: Connectivity test Pin
Moshe Katz6-Feb-12 14:36
Moshe Katz6-Feb-12 14:36 
GeneralRe: Connectivity test Pin
Member 78335217-Feb-12 3:31
Member 78335217-Feb-12 3:31 
GeneralThe beauty that is the default conversion... PinPopular
OriginalGriff31-Jan-12 0:40
mveOriginalGriff31-Jan-12 0:40 
GeneralRe: The beauty that is the default conversion... Pin
BobJanova31-Jan-12 0:43
BobJanova31-Jan-12 0:43 
GeneralRe: The beauty that is the default conversion... Pin
OriginalGriff31-Jan-12 1:01
mveOriginalGriff31-Jan-12 1:01 
GeneralRe: The beauty that is the default conversion... Pin
CDP180231-Jan-12 1:01
CDP180231-Jan-12 1:01 
GeneralRe: The beauty that is the default conversion... Pin
PIEBALDconsult31-Jan-12 2:26
mvePIEBALDconsult31-Jan-12 2:26 
GeneralRe: The beauty that is the default conversion... Pin
CDP180231-Jan-12 2:44
CDP180231-Jan-12 2:44 
GeneralRe: The beauty that is the default conversion... Pin
tgrt1-Feb-12 2:56
tgrt1-Feb-12 2:56 
GeneralRe: The beauty that is the default conversion... Pin
Gary Wheeler2-Feb-12 0:13
Gary Wheeler2-Feb-12 0:13 
GeneralRe: The beauty that is the default conversion... Pin
RobCroll31-Jan-12 11:11
RobCroll31-Jan-12 11:11 
RantEnabling backwards compatibility Pin
Chanoch Wiggers30-Jan-12 2:30
Chanoch Wiggers30-Jan-12 2:30 
GeneralRe: Enabling backwards compatibility PinPopular
CDP180230-Jan-12 3:17
CDP180230-Jan-12 3:17 
GeneralRe: Enabling backwards compatibility Pin
englebart1-Feb-12 2:42
professionalenglebart1-Feb-12 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.