Jump to content

HTTP Server Check program


Guest Leaskovski

Recommended Posts

Guest Leaskovski

Hi All,

I posted a question on one of the other forums to see if there was such a program that can monitor a server to see if it is up. I didn't get any replies so i thought i could purhapes try and create this simple app myself.

Anyway, so far i have thought of maybe using IE to try and load the index page of the user specified server to monitor. Is this possible? Can you create instance of pocket IE? I have done this before in VB and FoxPro but i have never done any programming for a PocketPC device.

If i was able to create an IE object, i assume that this would fire up an internet connection by GPRS if one was not available?

Any thoughts on this programme?

Cheers :)

Link to comment
Share on other sites

Guest Allan Olesen

Firing up IE sounds a bit clumsy to me.

You can access a webserver directly from .net. If you use HttpWebRequest, the GPRS connection will also fire up automatically. The C# syntax is more or less this:

using System.Net;

.

.

.

			try

			{

				String urlString = "www.example.com";

				HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlString );

				WebResponse resp = request.GetResponse(); 

			}

		   catch

			{

				// You will end up here if the server is not responding, or if the GPRS 

				// connection is not working

			}

A few notes:

Even for an empty page, this will create 4-5 kB of traffic per request.

If you only want to check that the server hardware and operating system is running, you could use some of the more low level networking stuff in System.Net.Sockets to send an UDP packet (works) or perhaps an ICMP Echo Request (not tested). This will create less than 100 bytes of traffic per request. However, this will not fire up the GPRS connection, and it is more difficult to program.

If you debug your application by deploying it to your device from within VS, the network connection will go through ActiveSync, and UDP will not work. This can be very confusing. Unplug the cable, and the network connection will go through GPRS and UDP will work, but you will be unable to debug from the PC.

All of the above relates to a smartphone without WiFi. Especially the GPRS part may be different for a PDA.

Edited by Allan Olesen
Link to comment
Share on other sites

Guest Leaskovski

Ah, some good info there. Thanks very much.

Question for you, you might not know the answer though. If i have a timer running in my app, does it fire if the pda side of the device is in standby? Probably no.

Link to comment
Share on other sites

Guest Allan Olesen
If i have a timer running in my app, does it fire if the pda side of the device is in standby? Probably no.

You are rigth: I don't know.

But I assume that a normal software timer will run as part of your program. As your program does not run when the PDA is in standby, I doubt it will work.

But you may be able to access some kind of hardware timer programmatically.

Link to comment
Share on other sites

Guest Allan Olesen
There must be some way of doing that as a calender notification fires and brings the pda out of sleep.

Have a look at Notify.RunAppAtTime in OpenNetCF. It will set a system notification which is supposed to be able to wake the device from standby. Example here. I have not tested it.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.