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

How-to: Support up to 63 simultaneous sockets


  • Please log in to reply
No replies to this topic

#1 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 July 2015 - 06:03 AM

By default, Netduino.IP supports up to 7 simultaneous sockets.

[Okay, Netduino.IP actually supports up to 8 sockets...but one of those sockets is system-reserved so that DNS and DHCP can do their jobs even when all the other sockets are in use.]

The setting which configures the maximum number of simultaneous sockets is in the IPv4Layer.cs file.
 
internal const byte MAX_SIMULTANEOUS_SOCKETS = 8; /* must be between 2 and 64; one socket (socket 0) is reserved for background operations such as the DHCP and DNS clients */ 

static internal Netduino.IP.Socket[] _sockets = new Netduino.IP.Socket[MAX_SIMULTANEOUS_SOCKETS]; 
To change the maximum number of simultaneous sockets, flash the debug build of the Netduino.IP firmware onto your Netduino. Add the Netduino.IP.dll and Netduino.IP.LinkLayers.[NameOfNetworkInterface].dll files to your solution (and add them as references to your project). And then simply change the MAX_SIMULTANEOUS_SOCKETS value to a number between 2 and 64.

Please note that traditional servers applications must have a minimum of 3 sockets (1 for the system, 1 for listening, and 1 to accept an incoming connection).

7 available sockets is plenty for most applications. But Netduino.IP is configurable, directly in Visual Studio, for applications with different requirements.

[Of course, be aware that more sockets = more memory and less CPU time per socket. So applications with lots of sockets may want to reduce their bandwidth usage per socket...and may want to use small socket.ReceiveBuffer and socket.SendBuffer sizes.]

[Also of note: the 63 socket option is really designed for Netduino.IP usage in sleepy applications on micros with lots of RAM (or running on an AOT-compiled edition of NETMF in non-sleepy applications). 63 high-bandwidth sockets under the NETMF interpreter is not the goal.]

Chris




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.