I'm a little late to the party but I have access to a Beagle 480 USB sniffer and all flavors of Netduino. If any debugging assistance is required, I'd be happy to help out.
- Netduino Forums
- → Patrick's Content
Patrick's Content
There have been 20 items by Patrick (Search limited from 22-May 23)
#47474 Looking for a few ninja code contributors...
Posted by Patrick on 22 March 2013 - 02:10 PM in General Discussion
#39624 Holding a hacknight with Netduino's and Windows Azure
Posted by Patrick on 19 November 2012 - 02:28 PM in Project Showcase
#38759 Introducing Netduino Plus 2
Posted by Patrick on 08 November 2012 - 04:50 PM in Netduino Plus 2 (and Netduino Plus 1)
#37255 Running out of memory
Posted by Patrick on 15 October 2012 - 11:42 PM in Netduino Plus 2 (and Netduino Plus 1)
#37252 Running out of memory
Posted by Patrick on 15 October 2012 - 10:28 PM in Netduino Plus 2 (and Netduino Plus 1)
private static void TestSockettPost() { int numTests = 1000; while (numTests > 0) { //write test data and show LED led.Write(true); Thread.Sleep(250); try { IPHostEntry host = Dns.GetHostEntry("www.SERVER.com"); IPEndPoint endPoint = new IPEndPoint(host.AddressList[0], 80); using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { socket.Connect(endPoint); using (NetworkStream ns = new NetworkStream(socket)) { //POST /somepage.php HTTP/1.1 //Host: example.com //Content-Type: application/x-www-form-urlencoded //Content-Length: 19 byte[] bytes = System.Text.Encoding.UTF8.GetBytes( "POST /PATH/FILE.php HTTP/1.1\r\n" + "Host: www.SERVER.com\r\n" + "Connection: keep-alive\r\n" + "Content-Length: 21\r\n" + "Cache-Control: max-age=0\r\n" + "Origin: null\r\n" + "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + "Accept-Encoding: gzip,deflate,sdch\r\n" + "Accept-Language: en-US,en;q=0.8\r\n" + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n" + "\r\n" + "TestID=&TestDesc=TEST"); ns.Write(bytes, 0, bytes.Length); Debug.Print("POST done"); } } } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } //hide LED led.Write(false); Thread.Sleep(250); numTests--; } Debug.Print("Test complete"); }
This just seems crazy to me. Anybody have any idea what could be going on or any input on how to troubleshoot?
#37195 Running out of memory
Posted by Patrick on 14 October 2012 - 11:41 PM in Netduino Plus 2 (and Netduino Plus 1)
#37192 Running out of memory
Posted by Patrick on 14 October 2012 - 10:43 PM in Netduino Plus 2 (and Netduino Plus 1)
#37187 Running out of memory
Posted by Patrick on 14 October 2012 - 09:59 PM in Netduino Plus 2 (and Netduino Plus 1)
Debug.Print("Memory Used: " + Debug.GC(true).ToString());
Memory Used: 35160 Memory Used: 36900 Memory Used: 36900 Memory Used: 38364 Memory Used: 40812 ...
Same thing if I pass the Debug.GC method false as well but it goes to iteration 563.
Once the program halts, If I hit pause in VS, the compiler highlights this line:
stOut = new StreamWriter(req.GetRequestStream());
#37184 Running out of memory
Posted by Patrick on 14 October 2012 - 08:49 PM in Netduino Plus 2 (and Netduino Plus 1)
Any ideas? Is it possible to do a POST using sockets instead?
int numTests = 1000; while (numTests > 0) { //write test data and show LED led.Write(true); Thread.Sleep(250); try { string strNewValue; //string strResponse; req = (HttpWebRequest)WebRequest.Create("http://SERVERNAME.com/PATH/TestInsert.php?"); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.KeepAlive = false; // Set values for the request back strNewValue = "TestID=''&TestDesc=AWholeBunchOfTestDataDoesItMatterHowMuchWePass"; req.ContentLength = strNewValue.Length; // Write the request stOut = new StreamWriter(req.GetRequestStream()); stOut.Write(strNewValue); stOut.Dispose(); stOut.Close(); req.Dispose(); } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } //hide LED led.Write(false); Thread.Sleep(250); numTests--; } Debug.Print("Test complete");
#35730 Ethernet Broken?
Posted by Patrick on 21 September 2012 - 09:39 PM in Netduino Plus 2 (and Netduino Plus 1)
#35726 Ethernet Broken?
Posted by Patrick on 21 September 2012 - 09:27 PM in Netduino Plus 2 (and Netduino Plus 1)
#35714 Ethernet Broken?
Posted by Patrick on 21 September 2012 - 04:23 PM in Netduino Plus 2 (and Netduino Plus 1)
#35641 Ethernet Broken?
Posted by Patrick on 20 September 2012 - 08:28 PM in Netduino Plus 2 (and Netduino Plus 1)
StreamWriter stOut = new StreamWriter(req.GetRequestStream());The N+ just sits there with the onboard led solid and the Ethernet activity light flashing.
Any idea?
using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using Microsoft.SPOT.Net.NetworkInformation; using System.Text; using System.IO; using System.Net; namespace BC { public class Program { public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); int numTests = 720; while (numTests > 0) { //write test data and show LED led.Write(true); Thread.Sleep(250); try { string strNewValue; string strResponse; HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://SERVERNAME/PATH/InsertFile.php"); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.KeepAlive = false; // Set values for the request back strNewValue = "TestID=''&TestDesc=TestData"; req.ContentLength = strNewValue.Length; // Write the request StreamWriter stOut = new StreamWriter(req.GetRequestStream()); stOut.Write(strNewValue); stOut.Close(); // Do the request to get the response StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream()); strResponse = stIn.ReadToEnd(); stIn.Close(); } catch (Exception ex) { Debug.Print(ex.Message.ToString()); } //hide LED led.Write(false); Thread.Sleep(250); numTests--; } } } }
#35560 Ethernet Broken?
Posted by Patrick on 20 September 2012 - 12:53 AM in Netduino Plus 2 (and Netduino Plus 1)
#35504 Ethernet Broken?
Posted by Patrick on 18 September 2012 - 10:35 PM in Netduino Plus 2 (and Netduino Plus 1)
#35480 Ethernet Broken?
Posted by Patrick on 18 September 2012 - 02:19 PM in Netduino Plus 2 (and Netduino Plus 1)
#35477 Ethernet Broken?
Posted by Patrick on 18 September 2012 - 01:47 PM in Netduino Plus 2 (and Netduino Plus 1)
#35315 Trigger a function based on time of day
Posted by Patrick on 15 September 2012 - 02:24 PM in Netduino Plus 2 (and Netduino Plus 1)
#34958 Watchdog redeux: Available in 4.2?
Posted by Patrick on 10 September 2012 - 02:01 PM in General Discussion
For the test project, we're using the web client example from the netmftoolbox project but updated for 4.2. We then changed the GET to a POST to test inserted data in the a database via php. This works well.
We then wrapped the code in a while to test longevity as this needs to be running for at least a few weeks at a time.
public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); // Creates a new web session HTTP_Client WebSession = new HTTP_Client(new IntegratedSocket("www.SERVERNAME.com", 80)); int numTests = 720; while (numTests > 0) { // Requests the latest source HTTP_Client.HTTP_Response Response = WebSession.Post("/InsertTest/InsertTest.php", "ID='',data=TestData"); // Did we get the expected response? (a "200 OK") if (Response.ResponseCode != 200) throw new ApplicationException("Unexpected HTTP response code: " + Response.ResponseCode.ToString()); led.Write(true); Thread.Sleep(2500); led.Write(false); Thread.Sleep(2500); numTests--; } }
Regardless of how long I sleep for (tested between 250 ms and 10000 ms) the application on the N+ becomes unresponsive (led stops blinking) but no exception is thrown and the debugger never disconnects. I also tried this without being attached to the debugger and got that same result.
I know I should aggregate the data and upload in batches instead but this should still work and leads me to believe there is some sort of memory leak in the firmware.
#26582 Introducing Netduino Go
Posted by Patrick on 05 April 2012 - 08:45 PM in Netduino Go
- Netduino Forums
- → Patrick's Content
- Privacy Policy