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 creation fails?


  • Please log in to reply
4 replies to this topic

#1 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 29 October 2011 - 01:24 PM

I have the following code lines:

if (explicitDHCP)
{
var interf = NetworkInterface.GetAllNetworkInterfaces()[0];
interf.EnableDhcp();
interf.RenewDhcpLease();
}

_OnboardLed = ledPort;

this._PortNumber = portNumber;
_ListeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_ListeningSocket.Bind(new IPEndPoint(IPAddress.Any, portNumber));
_ListeningSocket.Listen(10);

I tried different settings (explicitDHCP setting, static IP via MFDeploy, ...), but the code just seems to stop debugging at
_ListeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

Does anyone know this issue?

Greets, Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#2 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 29 October 2011 - 03:01 PM

I don't want to shout now, but i plugged out my Netduino for 2 hours now, plugged it in again just because I wanted to give it a last try... and code is running now... But no network cable plugged in... I think it has to do something with the network connection... I will dig into that...

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 October 2011 - 04:45 PM

Hi Markus, Are you sure that your code is stopping at that line...and not at one of the next lines (Bind, etc.)? The first line is just creating an object in memory... Please continue to share your experience. Also, please let us know which version of firmware you are running. Chris

#4 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 30 October 2011 - 12:54 PM

Ok, following scenario: Keeping my network cable unplugged during deploying code from PC to Netduino, everthing works fine. My code starts running on the N+, then i plug in my nw cable and I can connect to it. If I have my networkcable plugged in, it stops at the line shown above. I attached a picture of my network settings, it's a one to one connection between PC and Netduino. Could it be due to the wrong gateway settings that the creation fails? Shouldn't there be at least an exception? Greets, Markus

Attached Files


NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#5 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 31 October 2011 - 07:14 PM

Markus, have you added a few breakpoints to verify that it is that line which is failing? Could you wrap the entire block in a try/catch and see what exception is being thrown?

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 





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.