You probably need to put a try/catch around your incoming request and handle the exception gracefully. Also, "GET /favicon.ico HTTP/1.1" will cause problems unless you account for it. It seems that the IE browser will sometimes send this. Ref: http://www.avajava.c...i-have-one.html
I just kill it like this,
If (Not Request.IndexOf("favicon.ico") = -1) Then Debug.Print("received favicon.ico") Request = ""End IfIf (Request.Length > 0) Then ..
Baxter
I don't think that's the problem. I put try/catch around the appropriate code on the PC side, but it still only connects to the netduino maybe 5-50% of the time, I guess depending on the day. It's kind of a huge road block. Could this just be an annoying feature of an enterprise network?
Anyway, I implemented the check for favicon.ico, but I write in C#. Did I get the syntax right?
using (Socket clientSocket = socket.Accept()) { //Get clients IP IPEndPoint clientIP = clientSocket.RemoteEndPoint as IPEndPoint; EndPoint clientEndPoint = clientSocket.RemoteEndPoint; //int byteCount = cSocket.Available; int bytesReceived = clientSocket.Available; if (bytesReceived > 0) { //Get request //TimeSpan hoy = DateTime.TimeOfDay; byte[] buffer = new byte[bytesReceived]; int byteCount = clientSocket.Receive(buffer, bytesReceived, SocketFlags.None); string request = new string(Encoding.UTF8.GetChars(buffer)); if (!(request.IndexOf("favicon.ico") == -1)) { Debug.Print("received favicon.ico"); request = ""; } if (request.Length > 0) { Debug.Print(request); LCD.Position(0, 0); LCD.Print(DateTime.Now.TimeOfDay.ToString()); //Compose a response string response = "The time is: " + System.DateTime.Now.ToString() + ". Hello World!!!nThis response was sent due to a request from " + clientIP.ToString() + ".nPlease wait a few seconds before trying to connect again."; string header = "HTTP/1.0 200 OKrnContent-Type: text; charset=utf-8rnContent-Length: " + response.Length.ToString() + "rnConnection: closernrn"; clientSocket.Send(Encoding.UTF8.GetBytes(header), header.Length, SocketFlags.None); clientSocket.Send(Encoding.UTF8.GetBytes(response), response.Length, SocketFlags.None); //Blink the onboard LED led.Write(true); Thread.Sleep(1000); led.Write(false); } } }