Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

VanKurt

Member Since 24 Sep 2012
Offline Last Active Jan 25 2019 01:01 PM
-----

Topics I've Started

Problem with simple Webserver

06 September 2013 - 03:13 PM

Hello everyone,

I'm currently implementing a simple Webserver with my Netduino Plus 2. The code I use is pretty straight forward and similar to what you find in all those tutorials out there:

public void ListenerThread(){    mServerSocket.Listen(10);    while (true)    {        using (Socket clientSocket = mServerSocket.Accept())        {            // Try to read a request            int bytesReceived = clientSocket.Available;            if (bytesReceived > 0)            {                //Get request                var buffer = new byte[bytesReceived];                clientSocket.Receive(buffer, bytesReceived, SocketFlags.None);                string request = new string(Encoding.UTF8.GetChars(buffer));                // Compose a response                ProcessRequest(clientSocket, request);                clientSocket.Close();            }//end if        }//end using    }//end while}

Now to my problem:

 

When I connect to this Webserver from my PC that works fine in about 30% of the cases. In all other 70% percent my browser immediately (not waiting or anything!) shows an error message (Chrome):

 

 

...No data was received...

 

Or on Firefox:

 

 

....Zero sized reply...

 

When I hit the refresh button like mad I will finally get the website my Netduino should reply with.

So I started debugging the method shown above. In the debugger the problem becomes pretty obvious:

 

Posted Image

 

Calling "Available" on the TCP socket returns my 0 bytes. Thus the Netduino does not react (and does not respond with the HTML page). In the cases when it works the number of bytes is around 450, and the following Read-call returns a nice HTTP-Request sent by the browser.

 

So my question is: WTF are the browsers doing here? Why are they opening a TCP connection and not sending anything? Or am I handling the incomming connection the wrong way?

 

 

BTW: I'm using the 4.3 Beta Firmware from this Forum along with Visual Studio 2012.

I hope this problem isn't caused by the lwIP stack in the beta?


Netduino shuts down after a few seconds

24 August 2013 - 07:07 AM

Hi there,

Today I noticed that my Netduino Plus 2 shuts down after a few seconds. E.g. my blinking LED stops blinking, so program execution seems to have stopped.

 

Could that be due to the power supply? I have a 5V supply connected to the USB connector of the Netduino. After doing a little measurement it seems that the supply's voltage is actually between 5.2 and 5.3 Volts.

Is that too much? Could it cause the Netduino to shut down?

 

Or should I look for any other problems?


Evil MAC Address "00 04 A3 00 00 00"

14 August 2013 - 06:26 PM

Hi there,

as of today DHCP suddenly stopped working on my Netduino Plus 2. I didn't touch the device in days, so the problem somehow occurred on its own ;-)

 

When I look at my router's web interface, I can see that the Netduino is trying to get an IP with a MAC address of "[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]00 04 A3 00 00 00[/color]". That is not the address on the board's sticker (and I did not configure it either). Of course the DHCP IP address mapping won't work with this wrong MAC address.

While searching the forum's I saw that the above mentioned MAC appears rather often when people are having problems. Where does it come from?

 

I tried two things to solve the problem:

  • Re-set the MAC address via the MF Deploy Tool: The tool tells me that everything was written fine to the Netduino. When I disconnect it, and then reconnect connect it, I can read the previously made changes back without any problems. Although everything looks so good, the Netduino still appears with the wrong MAC ("[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]00 04 A3 00 00 00") when doing its DHCP thing with my router.[/color]
  • [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Set the MAC in code while starting up: Although this sets the MAC correctly, other settings get messed up. For example the gateway IP is set to 0 (and can't be changed since it's read only). Thus DHC won't work.[/color]
  • [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Restart the router and the Netduino a million times: no effect at all.[/color]

PS: I'm using a Netduino Plus 2 with 4.3 Firmware and an Arcor EasyBox router. As mentioned above this setup worked fine, until this MAC problem occurred today.

 

Can anyone help?

Thanks!


Sending data to php website

10 August 2013 - 01:38 PM

Hi there!

I'm currently trying to send data from the netduino plus to my webserver via a special php site. When I call the site manually from my webbrowser everything works fine. But when doing the same via code from the netduino it does not work.

 

Here's the sending code (inspired by these forums):

private void SendHttpRequest(string serverUrl, string request){  IPHostEntry host = Dns.GetHostEntry(serverUrl);  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))    {      byte[] bytes = System.Text.Encoding.UTF8.GetBytes("GET " + request + " HTTP/1.1rn");      ns.Write(bytes, 0, bytes.Length);    }  }}

And this is how I call it:

SendHttpRequest("www.mywebsite.com", "/netduino/submitData.php?data=5");

The problem is, that the php script on the website is never called. So I guess there is something wrong with the way I send the HTTP request?

 

Thanks for your help!


Link failure with brand new Netduino Plus 2

26 July 2013 - 05:33 PM

Hello,

I just installed VC#, the Netduino SDK 4.2.2.0 and the .NETM-Framework 4.2 as described on this site.

When I try to run my project on the Netduino Plus I get the following errors:

 

Create TS.
 
 Loading start at 806a988, end 8085288
 
Assembly: mscorlib (4.2.0.0)
 
Assembly: Microsoft.SPOT.Native (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
 
Assembly: Microsoft.SPOT.Net (4.2.0.0)
 
Assembly: System (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)
 
Assembly: Microsoft.SPOT.IO (4.2.0.0)
 
Assembly: System.IO (4.2.0.0)
 
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)
 
Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)
 
Assembly: SecretLabs.NETMF.Diagnostics (4.2.0.0)
 
Assembly: SecretLabs.NETMF.Hardware.Netduino (4.2.1.0)
 
Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)
 
Assembly: Microsoft.SPOT.Time (4.2.0.0)
 
Loading Deployment Assemblies.
 
Attaching deployed file.
 
Assembly: Microsoft.SPOT.Graphics (4.2.0.0)
 
Attaching deployed file.
 
Assembly: Neptune (1.0.0.0)
 
Attaching deployed file.
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0)
 
Attaching deployed file.
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0)
 
Resolving.
 
Link failure: some assembly references cannot be resolved!!
 
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0) needs assembly 'Microsoft.SPOT.Hardware' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.1.0.0) needs assembly 'mscorlib' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0) needs assembly 'mscorlib' (4.1.2821.0)
 
Assembly: SecretLabs.NETMF.Hardware (4.1.0.0) needs assembly 'Microsoft.SPOT.Hardware' (4.1.2821.0)
 
Error: a3000000

 

 

I've checked the target Framework version in the project settings. 4.2 should be right, right?

What elso could it be? What diud I do wrong?


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.