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.
Photo

Socket.Connect blocks all threads?


  • Please log in to reply
35 replies to this topic

#21 George Antoniadis

George Antoniadis

    Member

  • Members
  • PipPip
  • 25 posts

Posted 22 July 2011 - 07:36 AM

Without trying to sound pushy or something - simply wondering: Is there some guide on how to build the netduino firmwares from svn or some other version control system? Of course all the classic disclaimers will be taken for granted: no bitching on bugs, no bug reports on testing code and if it gets bricked we'll use it as a door stopper! ^_^ I simply want to test some bug fixes like the sockets and possible com fixes. Thanks in advance.

#22 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 22 July 2011 - 01:38 PM

Hi George,

Best bet is to download the .NET MF (4.1 QFE1) source from netmf.codeplex.com and then apply the latest Netduino source as a patch.

You can compile via GCC (free) or RVDS (preferred).

Chris

#23 George Antoniadis

George Antoniadis

    Member

  • Members
  • PipPip
  • 25 posts

Posted 22 July 2011 - 01:45 PM

I actually wanted to test the bleeding edge of 4.2beta2 since a couple of problems I had seem to be resolved in the issue tracker with a note "fixed for beta2" but can't find a public repository for its source. The bug fix is dated 15th of july but the latest commit on the head is july 9th :? Sorry I wasn't more clear before.

#24 Spork

Spork

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts

Posted 22 September 2011 - 05:17 AM

This topic seems to have fizzled out in July, but I discovered it after running into the same thing, today. In my case, the N+ is connected via Ethernet to a wireless router. A wireless IP camera is also connects to the router and the N+ reads from it. Everything worked fine during initial development, but then I decided to stress test it and make sure that the code was gracefully handling network problems. I disconnected the power to the router to sever the connection between N+ and IP camera and now the N+ tries to connect to the camera but hangs forever in Connect. I hope somebody will respond with an update on the issue. The thread seems to have left off with the codeplex bugs being closed but without any verification that the latest 4.2 RC fixes anything.

#25 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 22 September 2011 - 05:40 AM

What Firmware are you running now? I only experienced this particular issue on 4.2 BETA 2 (IIRC) 4.1 versions and 4.2 RC1 all throw exceptions. Edit: versions corrected

#26 erich

erich

    Member

  • Members
  • PipPip
  • 21 posts
  • LocationFrance

Posted 22 September 2011 - 01:09 PM

Today I have seen 4.2 RC hang with a Socket.Connect() - I modified the send and receive timeouts which had no affect.

#27 Robert L.

Robert L.

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts

Posted 22 September 2011 - 01:25 PM

Today I have seen 4.2 RC hang with a Socket.Connect() - I modified the send and receive timeouts which had no affect.



I am seeing the same thing on both versions. It is true that sometimes an exception will be generated, but not always. Sometimes it just locks up the entire machine, including all threads. To overcome this and potentially other lockups, I am adding an external watchdog timer chip. My plan is to use the MAX6751 which seems to have everything I need. Adding this chip to my design will be next week's goal. It's a shame that the ARM's built in watchdog timer is not supported.

#28 Stavros Tekes

Stavros Tekes

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationThessaloniki, Greece

Posted 22 September 2011 - 01:43 PM

I am seeing the same thing on both versions. It is true that sometimes an exception will be generated, but not always. Sometimes it just locks up the entire machine, including all threads. To overcome this and potentially other lockups, I am adding an external watchdog timer chip. My plan is to use the MAX6751 which seems to have everything I need. Adding this chip to my design will be next week's goal. It's a shame that the ARM's built in watchdog timer is not supported.


Hi Robert,

This is very interesting, we were looking for something like that. Keep us posted if it can work.

Also for making sure a socket.connect timeouts at some point, you might also want to look at this thread. The idea is to create the socket.connect at a thread and then create a "watchdog" thread that sleeps for some time and after that it kills the socket.connect thread.
Stavros

#29 George Antoniadis

George Antoniadis

    Member

  • Members
  • PipPip
  • 25 posts

Posted 22 September 2011 - 01:45 PM

In 4.2 socket.connect() should work much better. Can you provide the code that kills it? ps. please post the 4.2 version you are using too.

#30 lyme

lyme

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 September 2011 - 11:02 PM

I am also having problem with the "Socket hanging issue" when endpoint or cable is not present. I seems like this issue has been solved in 4.2 RC2, however I don't understand if this is available for Netduino Plus now? Thanks for any guidence - it would be my first firmware update. -Lyme

#31 Spork

Spork

    Advanced Member

  • Members
  • PipPipPip
  • 105 posts

Posted 27 September 2011 - 05:13 AM

Lyme, When I read the last few messages before yours, it seems like people are still experiencing problems with 4.2 RC2. If I'm wrong, then I'll be doing my first update too. If the issue isn't resolved, I'll probably end up trying to prevent the situation by preceding every connect attempt with a ping to the address in question. If there's no response to the ping in a reasonable amount of time, then there's no point in trying to connect. I read (in another thread) that there were problems with ping, but they were cleared up in 4.1, I think.

#32 Dan T

Dan T

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationBoston (Greater)

Posted 02 October 2011 - 08:39 PM

When I read the last few messages before yours, it seems like people are still experiencing problems with 4.2 RC2. If I'm wrong, then I'll be doing my first update too.


Spork, I think you are wrong. I read this thread and the ONLY reference to "RC2" was by ColinR. RC2 firmware was NEVER released and is not planned, afaik. Secretlabs intends to release an RC3 firmware as soon as .NETMF 4.2 is fully and completely released by the .NETMF crew. (Which is about 2 or 3 weeks late! Grrr!)

ColinR is a bit of a pro, I think. He probably constructed his own firmware by patching Microsoft's RC2 release with NetduinoPlus stuff.

ColinR, Where did your "RC2" code come from, exactly? Did you roll-your-own? Are you willing to share?

#33 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 03 October 2011 - 05:51 AM

ColinR is a bit of a pro


Hardly! Sorry for the confusion, I went back and checked versions. I'm running NetduinoPlusFirmware_v4.2.0.0_RC1 - with this version exceptions are thrown, and I don't see any hangs of this nature. I can't confirm, but it must have been 4.2 BETA 2 with the connect hangs.

Note: the only hangs I see are on Socket.Poll(SocketPollDuration, SelectMode.SelectWrite)

#34 hernanbosqued

hernanbosqued

    New Member

  • Members
  • Pip
  • 1 posts
  • LocationBuenos Aires, Argentina

Posted 29 October 2011 - 02:38 PM

Hello to all. Try this code and tell me.

            IPHostEntry host_entry = Dns.GetHostEntry(SERVER_IP);
            IPEndPoint ip = new IPEndPoint(host_entry.AddressList[0], SERVER_PORT);

            Type socketNative = typeof(NetworkInterface).Assembly.GetType("Microsoft.SPOT.Net.SocketNative");
            MethodInfo _connect = socketNative.GetMethod("connect", BindingFlags.Static | BindingFlags.Public);

            SocketAddress sa = ip.Serialize();
            byte[] bsa = new byte[sa.Size];
            for (int i = 0; i < bsa.Length; i++)
            {
                bsa[i] = sa[i];
            }

            unsafe
            {
                _connect.Invoke(null, new object[] { socket, bsa, false });
            }

This code works for me to avoid de Socket.Connect probem. Bye !

#35 Emilio x64

Emilio x64

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 22 August 2013 - 06:46 PM

Anybody knows whether these issues are really resolved in 4.3?



#36 Djeizan

Djeizan

    Member

  • Members
  • PipPip
  • 11 posts

Posted 24 August 2013 - 12:46 AM

My solution to this problem ...

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.