[En-Nut-Discussion] Large number of simultaneous network connections with the Ethernut OS.

Harald Kipp harald.kipp at egnite.de
Wed Sep 1 10:53:36 CEST 2004


Hello Louis,

you need to subscribe to the list at
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
to get posts through without moderator confirmation.

At 12:24 31.08.2004 +0000, Louis B wrote:

>1. Is it possible for the Ethernut board to send messages simultaneously 
>to seven other boards. (there is a low data rate with short fixed length 
>message so bandwidth should not be a problem). Is there a limit to the 
>number of simultaneous connections that can be handled by the Ethernut board?

This is limited only by available memory. Not sure how
much RAM a single connection consumes exactly, but not
more than a few hundred bytes. Seven concurrent connections
should be no problem.


>2. Which protocol do you recommend that I used to send messages between 
>the eight Ethernut boards; TCP/IP or UDP? (Please bear in mind that each 
>Ethernut may be required to send messages simultaneously to seven others. 
>I am using short fixed length packets of 16 bytes).

If the same message has to be sent to all nodes, then
UDP will significantly reduce the overhead, because
messages can be broadcasted. TCP doesn't support broadcasts.

Note that UDP is considered unreliable, so you need to
add some kind of ACK handshaking.

TCP is reliable and, as a result, complicated under the hood.
If data loss is no problem and maximum transfer speed doesn't
matter, UDP is the first choice anyway.


>3. What is the best way of integrating the Ethernut threads with the round 
>robin approach I have taken with the original software? Currently I am 
>thinking that there will need to be a separate thread for each of the 7
>network connections. These messages would need to be queued up so that 
>they could be handled by the idle task which would contain the round robin 
>control loop.

Yes, I'd suggest to create seven network receiver threads.
With Nut/OS it is possible to receive data in one thread
and transmit data on another using the same socket.


>4. As an alternative, is it possible not to use threads with the Ethernut 
>OS, but instead use a polling method for talking to the network 
>connections. For example having a system call that determines if there are 
>any packets available from the network that need to be read. This would 
>allow the round robin control loop to continue without being halted.

Yes, this is possible but consumes more CPU time than
the threaded model and may also consume more code space.
I assume, that Ethernut will be far from its limits for
this application, so you can use round robin, it this
makes porting easier.

In the first place keep an eye on data memory consumptions
(RAM). Typically this is the limit for most applications.



>5. Are network connections bi-directional? Would seven network connections 
>and seven tasks be needed to set up seven bi-directional links with the 
>other Ethernut boards? Or would 14 network connections and 14 tasks be 
>needed to set up single directional links?

TCP as well as UDP are, of course, bi-directional, although
many UDP applications use a server socket on both sides.




>I would be most grateful if you could point me in the right direction for 
>this project. It would be most useful if you could provide me with the 
>bare bones out line of how I should start coding this project. Finally 
>what is the most relevant sample code that I should look at when starting 
>this project.

Actually this is a simple application, but I know, that
"the devil hides in the details" as we say in Germany. :-)

One good example is
http://cvs.sourceforge.net/viewcvs.py/*checkout*/ethernut/nut/app/rs232d/rs232d.c?rev=1.2
That's already a bit too complicated, because it uses
continues streams and the StreamCopy() routine is used
for both transports, RS232 to LAN and LAN to RS232.

One good thing with Nut/OS is, that it is very similar
to PC programming. You may consider to try your application
outline on Linux or Windows first and later port it to
Nut/OS.

It is even possible to emulate Nut/OS on Linux (contributed
by Matthias Ringwald and available in CVS). A Win32 emulator
for Nut/OS is commercially available from
http://technology4gis.com/

But, as I said, your application doesn't look that difficult.
As usual, the main problem may be to get a feeling for the
capabilities, so best look to the examples and try to follow
them.



>Thanks in advance for your help.

You're welcome.




>(if you are interested the website for this my company website is 
>http://www.radamecbroadcast.co.uk)


Really cool stuff.

Harald




More information about the En-Nut-Discussion mailing list