RTCS-multiple connections

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTCS-multiple connections

Jump to solution
501 Views
mmiller
Contributor I

Hi,

I've got a K60F120 project that is acting as an audio controller and is being queried/commanded via UDP packets.  During initial development, the RTCS stack worked great - I created a socket, bound it to the appropriate port, called listen(), then accept() for each device that connected.

Just started testing with multiple devices and I'm seeing that I can connect 4 devices, then the 5th refuses the connection.  Disconnect one of the connected devices and the 5th can take its place.  This may be expected with the following:

    /* runtime RTCS configuration for devices with small RAM, for others the default BSP setting is used */

    _RTCSPCB_init = 4;

    _RTCSPCB_grow = 2;

    _RTCSPCB_max = 20;

    _RTCS_msgpool_init = 4;

    _RTCS_msgpool_grow = 2;

    _RTCS_msgpool_max  = 20;

    _RTCS_socket_part_init = 4;

    _RTCS_socket_part_grow = 2;

    _RTCS_socket_part_max  = 20;

although I can't explain why the _grow settings were ignored.

So I changed this to set the "_init"s to 10, to allow for more simultaneous connections.

However, this didn't appear to have any effect - it still properly connects 4 requests, and refuses the 5th.  I've made similar changes in the user_config.h file, in case that superseded the runtime configuration, but it also didn't appear to have any effect.

If I step into the RTCS_create function, I can see that the RTCS_msgpool_create calls are using the new init numbers, but it doesn't seem to change anything.

Any ideas as to what I might be doing wrong?

Thanks,

Matt

Labels (1)
0 Kudos
1 Solution
310 Views
Martin_
NXP Employee
NXP Employee

Hi Matt,

if you've created a listening socket, then, when a SYN is received from a client, the TCP process (TCP/IP task) needs to allocate memory for the new client socket. The major concern is usually the Tx and Rx window size for the new socket. If you configure this for say 4 KB, 4 connected clients consume 32 KB of memory just for send/receive buffers. There are socket options that you can call on the listening socket to reduce the size of these buffers.

-Martin

View solution in original post

0 Kudos
2 Replies
311 Views
Martin_
NXP Employee
NXP Employee

Hi Matt,

if you've created a listening socket, then, when a SYN is received from a client, the TCP process (TCP/IP task) needs to allocate memory for the new client socket. The major concern is usually the Tx and Rx window size for the new socket. If you configure this for say 4 KB, 4 connected clients consume 32 KB of memory just for send/receive buffers. There are socket options that you can call on the listening socket to reduce the size of these buffers.

-Martin

0 Kudos
310 Views
mmiller
Contributor I

Thanks Martin,

I modified the socket options to reduce the size of these buffers and was able to open a correspondingly larger number of sockets.  For now this will be sufficient - I may need to adjust further later.

Thanks again,

Matt

0 Kudos