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.

Duefectu's Content

There have been 13 items by Duefectu (Search limited from 19-April 23)


By content type

See this member's

Sort by                Order  

#57360 Hang on socket connect

Posted by Duefectu on 05 April 2014 - 11:22 PM in Netduino Plus 2 (and Netduino Plus 1)

I'm very disappoined about the ND2 network quality.

I solved the problem opening the socket in a new thread. If it hangs not freeze the main thread.

But at long time, I have hangs on the ND2, only if the Ethernet cable is pluged.

I try to change to UDP sockets, with less hangs, but many as desired.

No good quality for me, not for industrial use!




#54847 Read problems from SD Card

Posted by Duefectu on 23 December 2013 - 08:13 PM in Netduino Plus 2 (and Netduino Plus 1)

As I mentioned, you must implement your own ReadLine method.

 

This is a simple implementation. Not tested, and four sure, not the best implementation.

	public bool SearchText(string fileName, string textToFind)        {		var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);		string line="";		while(line!="ERROR")		{            			line=ReadLine(fs);			if(line==textToFind)			{				fs.Close();				return true;			}                }		fs.Close();                return false;        }	private static string Readline(FileStream fs)        {            try            {                byte[] buffer = new byte[1024];                byte b = 0;                byte r = 0;                int l = 1024;                for (int n = 0; n < 1024; n++)                {                    b = (byte)fs.ReadByte();                    if (b == 13)                    {                        r = (byte)fs.ReadByte();                        if (r == 10)                        {                            l = n;                            break;                        }                        else                        {                            buffer[n] = b;                            n++;                        }                    }                    bufer[n] = b;                }                string line = new string(Encoding.UTF8.GetChars(buffer, 0, l));                return line;            }            catch            {                return "ERROR";            }        }

Hope it helps!




#54830 Read problems from SD Card

Posted by Duefectu on 23 December 2013 - 09:07 AM in Netduino Plus 2 (and Netduino Plus 1)

I changed StreamReader to FileStream and it Works, but you must to implement the ReadLine method.




#54575 read file from SD

Posted by Duefectu on 09 December 2013 - 07:54 PM in Netduino 2 (and Netduino 1)

Right (or not), StremReader has a bug, at least for me. FileStream seams to work, at least for now!




#54572 read file from SD

Posted by Duefectu on 09 December 2013 - 05:47 PM in Netduino 2 (and Netduino 1)

Today I take the same error without any change on the code nor ND+2.

 

I changed StreamReader way by FileStream, and it works fine, but with more code.




#54523 read file from SD

Posted by Duefectu on 06 December 2013 - 09:04 PM in Netduino 2 (and Netduino 1)

I setup network interface to static in every start. I never use DHCP on this devices.




#54521 read file from SD

Posted by Duefectu on 06 December 2013 - 08:16 PM in Netduino 2 (and Netduino 1)

To disable network, I unplug the Ethernet cable! :rolleyes:

 

I re-flashed one ND+2, and now the same program Works!

I can't reproduce the error! :unsure:




#54519 read file from SD

Posted by Duefectu on 06 December 2013 - 06:51 PM in Netduino 2 (and Netduino 1)

@Nutz95, do you use Ethernet connection at same time, TCP Listener or Socket?

Today I making test without Ethernet connection, and it Works!




#54516 read file from SD

Posted by Duefectu on 06 December 2013 - 12:11 PM in Netduino 2 (and Netduino 1)

I have this exception Reading files in the 101 line of the file!




#54515 Read problems from SD Card

Posted by Duefectu on 06 December 2013 - 12:06 PM in Netduino Plus 2 (and Netduino Plus 1)

I have the same problema in c#. I open a file with StreamReader, and I can read entire file.

But if the file has more tan 100 lines, the ReadLine method fails with the System.IndexOutOfRangeException.

var sr = new StreamReader(fichero);while (!sr.EndOfStream){	string t = sr.ReadLine();	if (t == itemToSearch) return true;}sr.Close();



#54514 Need solution to Socket timeout hang issue

Posted by Duefectu on 06 December 2013 - 11:58 AM in Netduino Plus 2 (and Netduino Plus 1)

I open a new thread and connect from this new thread, it hangs the threat, but not the entire program.

However, the ND2 hangs after 1 or 2 days. If I unplug the Network cable it not hangs!




#53845 Hang on socket connect

Posted by Duefectu on 06 November 2013 - 01:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello:

 

I have several (12) NP2 with 4.2.2 firmware.

 

I use an IP socket to request the time to a server. Simply send "DATETIME" and it returns the time.

 

When I use socket.connect, and the server is down, the program hangs. No exception and no continue.

 

This is the simple code:

var ipB=new byte[]{ 192, 168, 0, 100 }var ep = new IPEndPoint(new IPAddress(ipB), 4000);Debug.Print("Connecting...");soc.Connect(ep);Debug.print("Connected!");

The console shows "Connecting...", but never "Connected!" or exception is the server/service is down.

 

To avoid hang of the NP2, I run this code in a new Thread. The application still running, but never continues to "Connected!", and the application hangs after time (minutes/hours).

 

Curiosity: If I abort the socket thread, I receive an IO exception when try to write to the SD card and when try to Access to IO ports.

 

Any suggestion?

 

Thanks for your time!




#53252 NP2 Firmware 4.3

Posted by Duefectu on 18 October 2013 - 11:39 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello:

 

If there a firmware update for NP2 to MicroFramework 4.3?

 

Thanks for your time!

 





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.