Any insights? Thanks in advance.
[size="4"] using System; using System.IO; using System.Net; using System.Text; using System.Threading; using Microsoft.SPOT; namespace M2W.NetduinoReader { class WebTest { public static void Main() { for(int i = 0; i < 20; i++) { Thread.Sleep(3000); using(HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(@"http://www.google.com")) { request.Timeout = 15000; request.ReadWriteTimeout = 5000; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = Encoding.UTF8.GetBytes("a=3&b=4"); request.ContentLength = bytes.Length; Debug.Print("request.GetRequestStream"); try { using(Stream requestStream = request.GetRequestStream()) { requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); } } catch(WebException ex) { Debug.Print("WebException on GetRequestStream: " + ex.Message); continue; } catch(Exception ex) { Debug.Print("Exception on GetRequestStream: " + ex.Message); continue; } Debug.Print("request.GetResponse"); try { using(HttpWebResponse response = request.GetResponse() as HttpWebResponse) { int respSize = System.Math.Min((int)response.ContentLength, 80); if(respSize != 0) { byte[] respData = new byte[respSize]; try { Debug.Print("request.GetResponseStream"); using(Stream responseStream = response.GetResponseStream()) { responseStream.Read(respData, 0, respData.Length); responseStream.Close(); } string responseString = new string(Encoding.UTF8.GetChars(respData)); Debug.Print("Response was: " + responseString); } catch(WebException ex) { Debug.Print("WebException on GetResponseStream: " + ex.Message); } catch(Exception ex) { Debug.Print("Exception on GetResponseStream: " + ex.Message); } } else { Debug.Print("Response was empty"); } response.Close(); } } catch(WebException ex) { Debug.Print("WebException on GetResponse: " + ex.Message); } catch(Exception ex) { Debug.Print("Exception on GetResponse: " + ex.Message); } } } } } } [/size]