Polling a web URL until event

Posted by Jaxo on Stack Overflow See other posts from Stack Overflow or by Jaxo
Published on 2012-10-12T21:32:43Z Indexed on 2012/10/12 21:36 UTC
Read the original article Hit count: 174

Filed under:
|
|

I'm really sorry about the crappy title - if anybody has a better way of wording it, please edit it!

I basically need to have a C# application run a function if the output of a URL is a certain value. For example, if the website says blue the background colour will be blue, red to make it red, etc.

The problem is I don't want to spam my webserver with checks. The 4 bytes it downloads each time is negligible, but if I were to deploy this type of system on multiple computers, it would get slower and slower and the bandwidth would add up quickly.

So my question is: How can my desktop application run a piece of code only when a web URL has a different output without checking each time? I can't use sockets, and any sort of LAN protocol won't end up working.

My reasoning behind this potentially nefarious code is to be able to mute computers by updating a file on the website (as you may have seen in my previous question today, sorry!). I'd like it to be rather quick, and not have the refresh time minutes apart, a few seconds at the most would be ideal.

How can I accomplish this? The website's code is easy, but getting the C# application to check when it changes is the part I'm stuck on. Nothing shows up on the website other than the command.

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about networking