using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using Microsoft.SPOT.Net.NetworkInformation; using Microsoft.SPOT.Net; using System.Net.Sockets; using System.Net; using System.Text; namespace NetduinoApplication2 { public class Program { public static void Main() { using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { IPHostEntry entry = Dns.GetHostEntry("192.168.5.111"); IPAddress address = entry.AddressList[0]; IPEndPoint endpoint = new IPEndPoint(address, 80); socket.Connect(endpoint); socket.Send(Encoding.UTF8.GetBytes("Hallo Netduino plus")); } } } }
This works.. I'v got IIS running on my notebook, and i'm seeing this in my logfiles:
2010-09-25 07:39:58 192.168.5.150 4098 192.168.5.111 80 - Hallo Netduino 400 - BadRequest -
Which is expected.
However, if I change the ip address in the code above to a non existant address (like 192.168.5.10)..just to test what happens.. this totally crashes the netduino plus and VS 2010. Only way to recover is to reset the netduino with the reset button.
Am I just the wrong code? or is this a bug?