Connection detection
How can an application determine if a network connection is present?
If it isn''t, can a connection be made without minimising the application?
Do you need different strategies for different types of connection (LAN, internet)?
********
A Problem Worthy of Attack
Proves It''s Worth by Fighting Back
spraff.net: don't laugh, I'm still just starting...
One solution is to simply access something on the client or server. If winsock reponds with an error, then there is no connection.
Kuphryn
Kuphryn
When you say network connection, you are referring to being ''logged-in'' with an ISP say, via Modem or DSL, right?
I don''t know of anyway to do this on windows, unless there is a ''dial-on-demand'' feature like there is on linux. Even then, it requires the person having that feature enabled. I doubt you want your app to implement the ins and outs of something like windows'' "Dial-up Networking".
Otherwise, you are left with what the other poster suggested: detect if you can ping some known network entity (e.g. ''ping yahoo'', or your own network server). If you don''t get a ping, then you [might not] have an active network connection. Keep in mind an error here could also mean that the internet server is down, not necessarily your network connection. This strategy is isn''t too hot for LANs, since you probably don''t even know any local addresses other than your localhost.
Good luck.
I don''t know of anyway to do this on windows, unless there is a ''dial-on-demand'' feature like there is on linux. Even then, it requires the person having that feature enabled. I doubt you want your app to implement the ins and outs of something like windows'' "Dial-up Networking".
Otherwise, you are left with what the other poster suggested: detect if you can ping some known network entity (e.g. ''ping yahoo'', or your own network server). If you don''t get a ping, then you [might not] have an active network connection. Keep in mind an error here could also mean that the internet server is down, not necessarily your network connection. This strategy is isn''t too hot for LANs, since you probably don''t even know any local addresses other than your localhost.
Good luck.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement