NoxiaZ - Viewing Profile: Topics - Netduino Forums
   
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.

NoxiaZ

Member Since 01 Aug 2012
Offline Last Active Mar 03 2014 07:57 AM
-----

Topics I've Started

Write to SD Card

25 February 2014 - 10:58 AM

Hey,

 

Im using framework 4.3 and trying to write to an SD card, but gives me an error:

 

An unhandled exception of type 'System.NotSupportedException' occurred in System.IO.dll

 

on this line:

 

Stream st = new FileStream(@"SDtest.txt", FileMode.OpenOrCreate);

 

Whats wrong? :S


Netduino plus 2 Ethernet problem

22 July 2013 - 10:03 AM

[font="calibri, sans-serif;"]Hey, [/font]

 

[font="calibri, sans-serif;"]I got some big issues with the netduino when I’m unplugging the network cable (To simulate network failure) and after a while (1-2 minutes sometimes more sometimes less) plugging in the network cable again it still won’t connect to the server. [/font]

[font="calibri, sans-serif;"]I have attached 2 files “Debug info.txt” and “Netduino Info.txt”. [/font]

 

Attached File  Netduino Info.txt   1.43KB   20 downloads[font="calibri, sans-serif;"] contains all the information about the netduino, firmware and such stuff.[/font]

 

Attached File  Debug Info.txt   14.54KB   8 downloads [font="calibri, sans-serif;"] contains information about the program that runs on the netduino and what it is trying to do. The line “Network: False” and “Network: True” is when I unplug the network cable, and plug it in again. You can see that after it write “Network: True” It keeps retrying and get exception with the socket connection.[/font]

 

 

private void Connect()    {	    connectThread = null;	    connectThread = new Thread(() =>	    {		    try		    {			    Print("Creating socket");			    Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); <-- This is where it fails???			    Print("Socket created");			    socket.ReceiveTimeout = 10000;			    socket.SendTimeout = 10000;			    //IPAddress ipAddress = HostnameToIPAdress(ServerHostname);			    //if (ipAddress == null)			    IPAddress ipAddress = IPAddress.Parse(ServerIP);			    EndPoint endpoint = new IPEndPoint(ipAddress, ServerPort);			    socket.Connect(endpoint);			    IsConnected = true;			    this.socket = socket;		    }		    catch (Exception e)		    {			    Print("Exception: " + e.ToString());			    IsConnected = false;		    }	    });	    connectThread.Start();	    int timeout = 0;	    while (connectThread.ThreadState != ThreadState.Stopped && connectThread.ThreadState != ThreadState.Aborted)  	  {		    if (timeout > 10)		    {			    Print("Timeout! ABORT!");			    connectThread.Abort();			    IsConnected = false;			    throw new TimeoutException();		    }		    Thread.Sleep(1000);	    }	    connectThread = null;    }

[font="calibri, sans-serif;"]I created everything in a thread for being sure it would n[/font][font="calibri, sans-serif;"]ever hang, it’s my own little timeout function.[/font]

[font="calibri, sans-serif;"]As you can see in the log it start failing at this line[/font][font="calibri, sans-serif;"] “[/font][color=#2b91af;][font="calibri, sans-serif;"]Socket[/color][/font][font="calibri, sans-serif;"] socket = [color=#0000FF;]new[/color][/font] [color=#2b91af;]Socket[/color]([color=#2b91af;]AddressFamily[/color].InterNetwork, [color=#2b91af;]SocketType[/color].Stream, [color=#2b91af;]ProtocolType[/color].Tcp);” [font="calibri, sans-serif;"]and I have no idea how to fix that? – I have tried nearly everything, also using the global variable instead of a local, but no difference.? You can see in the log that it stop printing [/font] “[color=#a31515;]Socket created”[/color][font="calibri, sans-serif;"] but just throw an exception [/font]

 

[font="calibri, sans-serif;"]Log (View the file for more detailed log information):[/font]

[font="calibri, sans-serif;"]A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll[/font]

[font="calibri, sans-serif;"]06/01/2011 00:06:01 : Exception: System.Net.Sockets.SocketException[/font]

[font="calibri, sans-serif;"]The thread '<No Name>' (0x23) has exited with code 0 (0x0).[/font]

[font="calibri, sans-serif;"]06/01/2011 00:06:01 : Reconnect failure[/font]

[font="calibri, sans-serif;"]06/01/2011 00:06:11 : Creating socket[/font]

[font="calibri, sans-serif;"]A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll[/font]

[font="calibri, sans-serif;"]06/01/2011 00:06:12 : Exception: System.Net.Sockets.SocketException[/font]

[font="calibri, sans-serif;"]The thread '<No Name>' (0x24) has exited with code 0 (0x0).[/font]

 

[font="calibri, sans-serif;"]I hope you guys can help me solving the problem, because it seems like I’m not the only one seeing this problem. I have been reading a lot about Ethernet problems on the forum, where people have created a watchdog to restart the netduino. But I don’t think that it’s the right way to do it, I want this bug to get fixed instead of creating some code to work around the problem, and I’m sure that it will help a lot of people [/font][font="wingdings;"] :)[/font]

 

[font="calibri, sans-serif;"]I can say that the same code is running on Windows and Linux with mono where it is working perfectly. [/font]

 

[font="calibri, sans-serif;"]Best regards [/font]

[font="calibri, sans-serif;"]Jesper [/font][font="wingdings;"] :)[/font]


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.