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.

TCP/IP Socket Connections

Other Parts Discussed in Thread: SYSBIOS

Is there a limit to the number of sockets which can be created using SYS/BIOS?  We're trying to create multiple connections, but can't seem to get above three.  There are no informational messages reported, and the program does not shut down.

Any thoughts?

  • Sorry, correction to my last post, cannot create more than three connections, not sockets.

  • In my config file:

    Ip.socketMaxConnections = 16;

    The TeraTerm will report 'connection refused' when create 4th connections. Why?

  • Luke, Rongbiao,

    Can you provide details of your application configurations?  What device and platforms are you using?

    It looks like you are with separate organizations, but both in the same city, so I wonder if this is the same project, or different?

    The default for Ip.socketMaxConnections is 8, so there should be no fixed limitation at 4.  It is a guess, but maybe you don’t have enough free RAM to support additional connections?

    Scott

  • Hi, Scott,

    we are working on the same project.

    We are using LM3S9B96 with CCS Version: 5.3.0.00090 and Tirtos_1-01_00_25. I already changed the Ip.socketMaxConnections to 16. and I tried to increase the HeapMem from x5000 to x6000 but still no success.

    I couldn't debug into the NDK API like accept(). So I don't know where the NDK refused the new connection.

    Any suggestion welcome.

    Thanks.

     

  • Rongbiao,

    OK, thanks for clarifying.

    I received two suggestions by internal email:

    1) You might be hitting a limit due to the Telnet module configuration(?)  The default number of connections for the server is 8, but maybe that has been reduced in your configuration?  For example:

    var Telnet = xdc.useModule('ti.ndk.config.Telnet');

    /* add a Telnet server (IPv6) */
    var telnetParams = new Telnet.Params();
    telnetParams.maxCon = ???;
    telnetParams.callBackFxn = '&ConsoleOpen';
    var telnet = Telnet.create(telnetParams);

    If you add a print statement like below to your config file you should be able to see what is configured for your application:

    print(“--------> telnet max con = “ + telnetParams.maxCon);


    2) You should review this wiki page regarding ways to tune memory usage by the network stack: http://processors.wiki.ti.com/index.php/TI-RTOS_Networking_Stack_Memory_Usage\


    Scott

  • Hi, Scott,

    In my project, Telnet is not enabled. We are using TCP/IP. The Ip.socketMaxConnections = 8;

    I'll try to tune the memory usage soon.

    Rongbiao

  • Hi Rongbiao,

    OK, thanks.

    A couple of other things to try… is the app failing at accept()?  If so, what is the return code?

    If failing elsewhere, what is the failure code reported?

    Also, once a connect failure happens, can you call mmCheck() and send that output?

    Thanks,
    Scott

  • Hi, Scott,

    Yes. It is failed at accept(). but it doesn't return anything.

    I'll try mmCheck() and see what will happen.

    Thanks,

    Rongbiao

  • Does accept() return a non-negative integer value?  Or INVALID_SOCKET?

  • Hi, Scott,

    I'm coming back to work on this issue again.

    The current situration is: the PC app. connect to MC and communicate with it. When PC app. exit, the connection broken. The PC app. restart and re-connect to MC still OK. Until PC app. re-connect to MC the 5th time, the MC crushed and report the following:

    ---------------------

    Network Added: If-1:192.168.252.200

    TCPdaemon: Creating thread clientfd = 536927860

    tcpRX: start clientfd = 0x2000de74

    tcpTX: start clientfd = 0x2000de74

    00047.200 TCP: Retransmit Timeout

    tcpRx stopped clientfd = 0x2000de74

    TCPdaemon: Closing connection ...

    TCPdaemon: New Socket OK

    TCPdaemon: New bind OK

    TCPdaemon: Listening...

    TCPdaemon: Creating thread clientfd = 536928884

    tcpRX: start clientfd = 0x2000e274

    tcpTX: start clientfd = 0x2000e274

    00079.800 TCP: Retransmit Timeout

    tcpRx stopped clientfd = 0x2000e274

    TCPdaemon: Closing connection ...

    TCPdaemon: New Socket OK

    TCPdaemon: New bind OK

    TCPdaemon: Listening...

    TCPdaemon: Creating thread clientfd = 536929908

    tcpRX: start clientfd = 0x2000e674

    tcpTX: start clientfd = 0x2000e674

    00275.600 TCP: Retransmit Timeout

    tcpRx stopped clientfd = 0x2000e674

    TCPdaemon: Closing connection ...

    TCPdaemon: New Socket OK

    TCPdaemon: New bind OK

    TCPdaemon: Listening...

    TCPdaemon: Creating thread clientfd = 536930932

    tcpRX: start clientfd = 0x2000ea74

    tcpTX: start clientfd = 0x2000ea74

    00303.100 TCP: Retransmit Timeout

    tcpRx stopped clientfd = 0x2000ea74

    TCPdaemon: Closing connection ...

    TCPdaemon: New Socket OK

    ti.sysbios.heaps.HeapMem: line 307: out of memory: handle=0x20015134, size=1608

    00316.720 mmBulkAlloc(): could not allocate memory.

    00316.720 out of memory: handle=0x20011c64, size=536943768

    00316.720 SBNew: Buffer OOM

    Network Removed: If-1:192.168.252.200

    TCPdaemon: New bind OK

    TCPdaemon: Listening...

    ------------------------

     

    The LM3S9D96 tcp_echo example shows that the 6th connection will reuse the first connection handle and go on:

    --------

    Starting the TCP Echo example

    System provider is set to SysMin. Halt the target and use ROV to view output.

    Network Added: If-1:192.168.252.200

    tcpHandler: Creating thread clientfd = 536909700

    tcpWorker: start clientfd = 0x20009784

    00014.800 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009784

    tcpHandler: Creating thread clientfd = 536910212

    tcpWorker: start clientfd = 0x20009984

    00024.900 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009984

    tcpHandler: Creating thread clientfd = 536910724

    tcpWorker: start clientfd = 0x20009b84

    00034.700 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009b84

    tcpHandler: Creating thread clientfd = 536911236

    tcpWorker: start clientfd = 0x20009d84

    00042.400 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009d84

    tcpHandler: Creating thread clientfd = 536911748

    tcpWorker: start clientfd = 0x20009f84

    00052.200 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009f84

    tcpHandler: Creating thread clientfd = 536909700

    tcpWorker: start clientfd = 0x20009784

    00078.700 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009784

    tcpHandler: Creating thread clientfd = 536910212

    tcpWorker: start clientfd = 0x20009984

    00089.500 TCP: Retransmit Timeout

    tcpWorker stop clientfd = 0x20009984

    tcpHandler: Creating thread clientfd = 536910724

    tcpWorker: start clientfd = 0x20009b84

    ------------------

     

    Is there anyway for me to set this magic number of connections so I can limit it to 4 or less?

    Is there another way for me to wait longer until the connection release all its resourses?

     

    Regards,

    Ron

     

     

  • This memory issue has been solved. My code has the same beheaver like the tcp-echo does.

    The Memory issue was caused by the BIOS does NOT 'delete terminated tasks' even I saw the OPTION is checked. By enable the Idle Task, The 'delete terminated tasks' will work and eliminated the memory issue.