Simple C# HTTP Server for Windows Mobile

Recently Iíve been trying to pay a debt of sorts.  I use the software provided on the fantastic XDA-Developers frequently on my Windows Mobile devices and have been doing for almost three years now.

So currently, if I have a little bit of free time, Iíll nip past their development section and try and fulfil a random request.

Today’s request might come in useful to a little bit of a wider audience so Iíll post it here.  The initial problem is outlined in this thread and the upshot was that someone needed a very simple Http server that could run on Windows Mobile, written in C#’, and was programmable.

What the guy really seemed to be looking for was something that used the Http protocol to return random computed data, so after a tiny bit of googling and a simple MSDN example, Iíve built a really simple web server for Windows Mobile.

Amusingly, my sample doesnít behave much like a web server at all.  It just tells you what you requested, but it should be enough to get you going in the right direction.  Itís derived from the MSDN example with some additional sugar, and I certainly wouldnít suggest that itís got a threading model thatíd stand up in a production environment (at a glance it looks like itíd process requests in sequenceÖ) but hopefully itís useful to somebody looking to produce a simple server, or who is just interested in how Http works.

Iím not really sure if I can accurately call it a webserver, seeing as it doesnít even support a full set of Http Verbs, but you get the idea.

Iíve not actually bothered compiling this on a mobile device yet (lack of inclination) however seeing as it was explicitly based on a socket programming for Windows Mobile MSDN example, I suspect itíll work just fine.  No warranty, do what you will with it.

Download Simple C# Http Server for Windows Mobile (Source Code Only) (7kb)

One Response to “Simple C# HTTP Server for Windows Mobile”

  1. tikejhya Says:

    hello mate, i was wondering to give a try can u plz let me know how it really works for windows mobile…. can u give me few breif procedure to use it by the way i was also trying to use this with WPF and trying to make it bigger.

Leave a Reply