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.
To change your static IP (or to test out the "unsupported" DHCP):
Run MFDeploy. Target menu > Configuration > Network
We haven't even made the announcement yet, and community members are already building stuff Fantastic!
Chris
I dont have a Microsoft.SPOT.Net. Do I need an update for .NET MF ?
EDIT
Make sure you click on the references text inside the Solution explorer and then go to add reference, then all the .NET MF stuff will show up and go down to Microsoft.SPOT.Net
Correction: it's the System(.dll) assembly that you need to add for networking.
You only need to add Microsoft.SPOT.Net(.dll) if you want to change your IP settings in code...
Chris
Correction: it's the System(.dll) assembly that you need to add for networking.
You only need to add Microsoft.SPOT.Net(.dll) if you want to change your IP settings in code...
Chris
Socket output = new Socket(AddressFamily.Unknown, SocketType.Unknown, ProtocolType.IPv6);
What should be used instead of what I have there? I get a socket exception, nothing specific, it just says socket exception right on that line.
EDIT:
now I get tan error here:
output.Send(Encoding.UTF8.GetBytes("Hello World!"), 12, SocketFlags.None);
do I call .Connect first? I would imagine I have to, but what is theis EndPoint thing and how do I use it (new EndPoint doesnt work and there is no EndPoint.Something)?
I have edited them in my post above so I don't confuse anyone
Chris
SAme here, I guess I am the first to lock up the Netduino Plus ... MF deploy didnt fix it, 3V3 to /RESET didnt fix it... this is the code.
public static void Main()
{
using (Socket output = ConnectSocket("192.168.1.46", 50))
{
output.Send(Encoding.UTF8.GetBytes("Hello World!"));
}
}
/// <summary>
/// Open Socket to given Server and Port
/// From: SocketClient example
/// </summary>
/// <param name="server">Server</param>
/// <param name="port">Port</param>
/// <returns>New Socket</returns>
private static Socket ConnectSocket(String server, Int32 port)
{
// Get server's IP address.
IPHostEntry hostEntry = Dns.GetHostEntry(server);
// Create socket and connect to the server's IP address and port
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(hostEntry.AddressList[0], port));
return socket;
}
the bottom method is from your weather thing.
I guess I have to do the completely erease with the gold square [which is now a little ball of solder?] and all that mess right?
I guess I have to do the completely erease with the gold square [which is now a little ball of solder?] and all that mess right?
Oz,
It's pretty hard to break a Netduino using software, so let's see if we can fix this by simply erasing the offending Netduino app... [It sounds like you tried this, but let's try it again.]
1. Unplug your Netduino Plus from your PC
2. Start up MFDeploy, select USB transport
3. Hold down the pushbutton on your Netduino Plus while plugging it into your PC
4. Immediately press PING in MFDeploy...you should see "TinyBooter...Netduino Plus by Secret Labs"
5. Now, press ERASE and confirm YES.
6. Unplug and re-attach your Netduino Plus. It should be all better.
If you've set some invalid IP address settings, you may need to use Target > Configuration > Network in MFDeploy immediately upon plugging in your Netduino Plus...and then set the values to safe values.
Of course if all else fails, the "erase and reflash" process works well too. But that's the backup, backup plan.
Also...if you can create a solution which causes .NET MF to lock up, we can debug it on our end.
If you've set some invalid IP address settings, you may need to use Target > Configuration > Network in MFDeploy immediately upon plugging in your Netduino Plus...and then set the values to safe values.
That fixed it! Umm yeah I don't really know what unsafe IPs are... I had it on 192.168.1.50, the computers on my network are 192.168.1.45/46/47. What is a safe address? The default gateway should be my router's address(192.168.1.1) right?
EDIT:
It locked up again after deploying this:
using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
IPHostEntry entry = Dns.GetHostEntry("192.168.1.46"); // this is my computer's ip
IPAddress address = entry.AddressList[0];
IPEndPoint endpoint = new IPEndPoint(address, 20);
socket.Connect(endpoint);
socket.Send(Encoding.UTF8.GetBytes("Hello World!"));
}
Yes, the default gateway address means your router's address ...
When your Netduino need to communicate with a destination address not in your subnet, it will send this packet to this address by default. If no other static route in Netduino match this destination.
But in your case, you probably not need to specify any other static route.
Pascal
There's also the System.Http assembly...which gives you the ability to download and parse web pages with ease. It _might_ be too big if you're running a sophisticated program--but it might not be. Feel free to play with it, and maybe we can free up some additional flash for code as well...
I was able to download Netduino's home page with this code, but you're so right Chris. It's pretty big. Increasing buffer to 1024 threw an out of memory exception. So, reader.ReadToEnd() is out of the question. I guess we need something smaller or free up more memory.
Will my app automatically use SDcard as extra memory? or is it only for data storage?
WebRequest request = HttpWebRequest.Create("http://www.netduino.com");
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
const int bufferMax = 512; //1024 ran out of memory.
int charsRead = -1;
while (charsRead != 0)
{
char[] buffer = new char[bufferMax];
charsRead = reader.Read(buffer, 0, bufferMax-2);
if (charsRead > 0)
{
buffer[charsRead+1] = (char)0;
Debug.Print(new string(buffer));
}
}
That fixed it! Umm yeah I don't really know what unsafe IPs are... I had it on 192.168.1.50, the computers on my network are 192.168.1.45/46/47. What is a safe address? The default gateway should be my router's address(192.168.1.1) right?
EDIT:
It locked up again after deploying this:
I've been having some similar issues here, and I think I narrowed it down to port behavior at the destination (my PC). With Windows Firewall enabled, port 80 worked fine, but port 8080 caused the nasty hang that you've been experiencing. I tried opening port 8080 in Windows Firewall, to no avail. Finally I got pissed and disabled Firewall completely, now when connecting to port 8080 I get an exception, SocketException 10054. That exception appears to relate to premature port closure by the remote host, so I'll consider that an improvement. At least I don't have to do the MFDeploy-button-press dance any more.
Dang it, posted too soon! The SocketException was a result of the Python script I was running on my PC not actually listening on the port. All fixed, works fine. Netduino code is as follows:
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 NetduinoApplication1
{
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.1.102");
IPAddress address = entry.AddressList[0];
IPEndPoint endpoint = new IPEndPoint(address, 8080);
socket.Connect(endpoint);
socket.Send(Encoding.UTF8.GetBytes("Hello Netduino Plus"));
}
}
}
}
And the Python code is:
from socket import *
HOST = '192.168.1.102'
PORT = 8080
BUFSIZ = 1024
ADDR = (HOST, PORT)
serversock = socket(AF_INET, SOCK_STREAM)
serversock.bind(ADDR)
serversock.listen(2)
print 'Waiting for connection...'
clientsock, addr = serversock.accept()
print 'connected from:', addr
while 1:
data = clientsock.recv(BUFSIZ)
if not data: break
print data
clientsock.close()
serversock.close()
I was just about a post a "why doesn't it work" question, but solved it myself...
If no networking functionality is working and no LEDs light up when you plug the ethernet cable in, you've probably flashed your Netduino Plus with the 4.1.0.4 firmware meant for your standard Netduino.
If no networking functionality is working and no LEDs light up when you plug the ethernet cable in, you've probably flashed your Netduino Plus with the 4.1.0.4 firmware meant for your standard Netduino.
Just FYI, we fully support the use of the standard Netduino firmware on the Netduino Plus. You'll lose the integrated networking (and the MicroSD card feature--but only for a few weeks)--but we designed the two boards to be electrically compatible.
We figured that some Netduino Plus users wouldn't need the networking and would want to erase-and-reflash to double the amount of Flash/RAM available to their programs. There's no harm in switching back and forth between the two on the Netduino Plus.