Working online

  • Thread starter Thread starter MajorTom
  • Start date Start date
M

MajorTom

Hello group,

I need to know the best and best responsive way to determinate is a windows
form (or the desktop computer) is online (access to internet).

I particularly interested for a quick check.

TIA

MajorTom
 
You can make an HTTP Request for instance and see if you get a response.
http://www.knowdotnet.com/articles/activesynccradle.html
http://www.devbuzz.com/content/zinc_network_connectivity_pg1.asp

Although the last method I reference in each article is used in reference to
determining if a PDA is cradled, the first example in each article shows you
how to use the HTTP Request - but you can use many similar approaches. A
more direct approach though involves P/Invoking IsDestinationReachable if
you are comfortable P/Invoking stuff (and if you aren't - trust me, there's
nothign to be afraid of)


[DllImport("sensapi.dll")]
private extern static bool IsDestinationReachable(string dest,IntPtr ptr);

bool HasConnectivity =
IsDestinationReachable(www.msmvps.com/WilliamRyan,IntPtr.Zero);

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Thanks, I use the P/Invoking , I trust you.

now a few questions:

Is my application dependable of something more than the framework when I use
the [DllImport("sensapi.dll")] ?

Is there a way to get a respond more rapid, I know that I have to wait for
the timeout. How that works ?

Thank very much for your response

Major Tom

William Ryan eMVP said:
You can make an HTTP Request for instance and see if you get a response.
http://www.knowdotnet.com/articles/activesynccradle.html
http://www.devbuzz.com/content/zinc_network_connectivity_pg1.asp

Although the last method I reference in each article is used in reference to
determining if a PDA is cradled, the first example in each article shows you
how to use the HTTP Request - but you can use many similar approaches. A
more direct approach though involves P/Invoking IsDestinationReachable if
you are comfortable P/Invoking stuff (and if you aren't - trust me, there's
nothign to be afraid of


[DllImport("sensapi.dll")]
private extern static bool IsDestinationReachable(string dest,IntPtr ptr);

bool HasConnectivity =
IsDestinationReachable(www.msmvps.com/WilliamRyan,IntPtr.Zero);

--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
MajorTom said:
Hello group,

I need to know the best and best responsive way to determinate is a windows
form (or the desktop computer) is online (access to internet).

I particularly interested for a quick check.

TIA

MajorTom
 
Back
Top