C# GUI interface to Web Server February 07, 2011, 08:51:22 pm Having great fun (and learning) from the Web Server platform - here on my bench for the last 4 days :), my thoughts are now turning towards a Windows GUI interface to toggle LED2, plus anything else I hang off the header.I’m guessing a GUI button could ‘talk’ to the server via http, has anyone tried this?Has anyone any pointers as how to implement this?At the moment I have a new C# project started, a single button on Form1, but have NO idea what needs to go into the event handler for the button :)RegardsKevin Last Edit: January 01, 1970, 01:00:00 am by Guest
Re: C# GUI interface to Web Server Reply #1 – February 07, 2011, 09:39:56 pm you could get a minimalist pipe running on a nonstandard port to input commands to the web server Last Edit: January 01, 1970, 01:00:00 am by Guest
Re: C# GUI interface to Web Server Reply #2 – February 08, 2011, 07:53:52 pm Update (& a happy man)....OK I now have a very basic version working, below is the code for the button click event handler: private void button1_Click(object sender, EventArgs e) { // In this method you need to set up an event int count; byte[] buffer = new byte[8192]; // create the request HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://192.168.0.5/leds.cgi?led=1"); // send request & get a response HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // process the response Stream responseStream = response.GetResponseStream(); count = responseStream.Read(buffer, 0, buffer.Length); response.Close(); }Now I can toggle LED2 via a simple windows application. The learning continues :)RegardsKevin Last Edit: January 01, 1970, 01:00:00 am by Guest