. Any help would be much appreciated.Socket clientSocket = listnerSocket.Accept();
namespace Serve_web_page { public class Program { public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); int port = 80; Thread.Sleep(5000); NetworkInterface networkInterface = NetworkInterface.GetAllNetworkInterfaces()[0]; Debug.Print("My IP address :- " + networkInterface.IPAddress); Socket listnerSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, port); listnerSocket.Bind(endpoint); listnerSocket.Listen(1); while (true) { Socket clientSocket = listnerSocket.Accept(); bool dataReady = clientSocket.Poll(5000000, SelectMode.SelectRead); if (dataReady && clientSocket.Available > 0) { byte[] buffer = new byte[clientSocket.Available]; int byteRead = clientSocket.Receive(buffer); string request = new String(System.Text.Encoding.UTF8.GetChars(buffer)); if (request.IndexOf("ON") >= 0) { led.Write(true); } else if (request.IndexOf("OFF") >= 0) { led.Write(false); } string statusText = "LED is "+ (led.Read() ? "ON" : "OFF" + "."); string response = "HTTP/1.1 200 OK\r\n"+ "Content-Type: text/html; charset=utf-8\r\n\r\n"+ "<html><head><title>NetDuino Plud LED Sample</title></head>"+ "<body>" + statusText + "</body></html>"; clientSocket.Send(System.Text.Encoding.UTF8.GetBytes(response)); } clientSocket.Close(); } } } }