Other Parts Discussed in Thread: SYSBIOS
Tool/software: Code Composer Studio
verson: ndk_2_25_00_09/tirtos_tivac_2_16_00_08
problem: tcp server only support 11 clients,12th clients is fail Failure,I need to 16 tcp clients for tcp server
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello user3511888,
Each of your TCP client creates socket on the NDK which allocates memory from BIOS heap.
The amount of memory needed for each socket/client depends on some parameters like TCP receive/transmit buffer size etc. Please check what size you are setting in your XDC config file. You would have something like below with may be different values.
Tcp.transmitBufSize = 8192;
Tcp.receiveBufSize = 8192;
Tcp.receiveBufLimit = 8192;
Udp.receiveBufSize = 8192;
Now as you are allocating only 200Kb (seen from ROV), to enable more than 11 clients you have to increase heap size.
Please search BIOS heap configuration (like below) and increase heap size.
/* create a default heap */
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0xA0000;
Other option is to decrease TCP buffer sizes which will allow more clients to be accommodated with current heap.
I think it is something paraments is wrong.
Tcp.transmitBufSize = 1460;
Tcp.receiveBufSize = 1460;
Tcp.receiveBufLimit = 1460;
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize =204800;
tcp server only support 11 clients
and if modified
Tcp.transmitBufSize = 1460;
Tcp.receiveBufSize = 1460;
Tcp.receiveBufLimit = 1460;
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize =0xa0000;
it is wrong . the ram of my mcu(tm4c129ekcpd) only 512kB .
200Kb is Enough for more than 16 clients
and if modified
Tcp.transmitBufSize = 400;
Tcp.receiveBufSize = 400;
Tcp.receiveBufLimit = 400;
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize =204800;
tcp server only support 11 clients
and if modified
Tcp.transmitBufSize = 8192;
Tcp.receiveBufSize = 8192;
Tcp.receiveBufLimit = 8192;
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize =204800;
tcp server only support 11 clients,too.
I think multiple clients is limited by some paraments,can you tell me ,what paraments i want to modify
Hello,
How are you creating your TCP server? Are you using NDK DaemonNew?
If yes, call to daemonnew has one of argument as MaxSpawn which is "Maximum number of tasks which can be spawned to handle the daemon". Can you check if it is limiting factor?
**********************
.....
result = select(maxsock, &testfds, (fd_set *)0,(fd_set *)0, &timeout);
......
**********************
I think it related to "select()"
typedef struct _fd_set {
unsigned int count;
void *fd[NDK_FD_SETSIZE];
} fd_set;
#define NDK_FD_SETSIZE 16
but I modified "socket.h" and "socketndk.h"
#define NDK_FD_SETSIZE 32
It is not succsess.
I debug project, I found problem,but I don't know how to change it, how to rebuild "fileuser.c " for "select()"