Jump to content


Photo

HTTP Server Check program

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Leaskovski

Leaskovski

    Regular

  • Members
  • PipPip
  • 132 posts
  • Location:Here
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 :)

  • 0

#2
Allan Olesen

Allan Olesen

    Newbie

  • Members
  • Pip
  • 8 posts
  • Devices:SPV C500 (HTC Typhoon)
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, 17 July 2006 - 07:21 AM.

  • 0

#3
Leaskovski

Leaskovski

    Regular

  • Members
  • PipPip
  • 132 posts
  • Location:Here
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.

  • 0

#4
Allan Olesen

Allan Olesen

    Newbie

  • Members
  • Pip
  • 8 posts
  • Devices:SPV C500 (HTC Typhoon)

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.

  • 0

#5
Leaskovski

Leaskovski

    Regular

  • Members
  • PipPip
  • 132 posts
  • Location:Here
There must be some way of doing that as a calender notification fires and brings the pda out of sleep.

  • 0

#6
Allan Olesen

Allan Olesen

    Newbie

  • Members
  • Pip
  • 8 posts
  • Devices:SPV C500 (HTC Typhoon)

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.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users