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

Quick question about ND+2 Socket


  • Please log in to reply
8 replies to this topic

#1 elettrozero

elettrozero

    Advanced Member

  • Members
  • PipPipPip
  • 58 posts

Posted 11 August 2013 - 09:15 AM

As far as I tested you cannot have more than 5 open connection to ND+2, do you agree?

 

Simple code:

Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.100"), 8080);serverSocket.Bind(localEndPoint);serverSocket.Listen(0);while (true){   Socket clientSocket = serverSocket.Accept();   clientSocket.Send(new byte[] { (byte)'a', (byte)'b', (byte)'c' });}

This way you can telnet the server 5 times and receive abc, the sixth time you won't connect.

What I need is about 10 persistent contemporary connections...is there a way? 



#2 cce1911

cce1911

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts
  • LocationGeorgia, USA

Posted 21 August 2013 - 12:50 PM

http://msdn.microsof...y/ee434782.aspx

 

socket.listen(backlog)

 

backlog = The maximum number of incoming connections that can be queued for acceptance. Try

serverSocket.Listen(10);



#3 elettrozero

elettrozero

    Advanced Member

  • Members
  • PipPipPip
  • 58 posts

Posted 21 August 2013 - 05:20 PM

Thanks for replying but that doesn't work. Actually I don't think that is related to queued connections but to concurrent connections. For truth's sake, with the whole code loaded, the ndp2 only accepts 4 connections; 5 with only the code above. That leads my to think that it is about memory availability or something like it.



#4 elettrozero

elettrozero

    Advanced Member

  • Members
  • PipPipPip
  • 58 posts

Posted 26 August 2013 - 12:26 PM

Actually I hoped Chris would have answered this...



#5 someengineer

someengineer

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 August 2013 - 02:07 PM

Hey,

 

your observed 5 max connections correlate with a define for the lwip stack.

 

looking into: netduino2firmwareSolutionsNetduinoPlus2lwipselector.h 

- the netduino plus 2 uses the small memory profile definitions, which are defined in 

 

netduino2firmwareDeviceCodepalnetNetwork_defines_lwip.h

 

searching the file, we find: 

/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCPconnections. */#define MEMP_NUM_TCP_PCB__min 5

guess this answers the question, increasing that amount and recompiling the firmware should solve that problem..

 

be aware:  i dont know if you will step on any sideeffects and may have to increase any other buffers relating to this, increasing by 1 or 2 may be harmless.. if you need more, try using the medium lwip stack defines - should be done by changing lwipselector.h

 

regards



#6 derwissel

derwissel

    New Member

  • Members
  • Pip
  • 1 posts

Posted 27 August 2013 - 07:52 PM

Somehow, my post on my company-account does not get approved for ages now.. 

however:

 

your problem with the 5 max allowed connections simply is a define in the lwip stack. havent got the sources at home, but within the firmware, netduino uses something called the "small memory profile" - which includes only 5 listening tcp connections..

 

so its up to compile your own firmware, if you really need more than 5..

 

greets

derwissel



#7 elettrozero

elettrozero

    Advanced Member

  • Members
  • PipPipPip
  • 58 posts

Posted 29 August 2013 - 08:43 AM

You know, this is really getting frustrating.

When you buy a product you usually receive a certain assistance from seller but int this case most questions are asked via forum and sometimes without an answer.

Since I'm using this Secret Labs's product in production environment I'ma a bit worried (and disappointed) about the sake of my clients which are not going to ask me questions via forum.

The point is: if I need to know the limit of this product I must have an answer or I'll need to go further with other products.



#8 Anthony Glenwright

Anthony Glenwright

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 30 August 2013 - 05:24 AM

You'll find a good explanation of socket limits here:  http://forums.netdui...imit#entry19680



#9 elettrozero

elettrozero

    Advanced Member

  • Members
  • PipPipPip
  • 58 posts

Posted 30 August 2013 - 12:02 PM

Thank you Anthony, I have the picture clear. It was like I supposed.






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.