Hi Pravin,
Probably you are setting a small number of sockets and the socket timeout is too long. Therefore, if you close all the sockets you have available and you don't wait until their timeout expires you will not be able to use another socket.
You can use function setsockopt() to manage sockets timeouts. These timeouts are declared in tcp_prv.h on the RTCS library project.
| #define TCP_MSL | 120000L /* Maximum Segment Lifetime; the |
| | longest time that a packet can |
| | travel in the Internet (2 min) */ |
#define TCP_WAITTIMEOUT (2 * TCP_MSL) /* timeout for TIME_WAIT state, defined
#define TCP_SENDTIMEOUT_MIN 100000L /* as per RFC1122 4.2.3.5 */
#define TCP_OPENTIMEOUT_MIN 180000L /* as per RFC1122 4.2.3.5 */
But you can override these values with setsockopt().
You can also increase the number of sockets. It is possible customize runtime RTCS configuration before call the function RTCS_create() just as the web_hvac does in the C:\Freescale\Freescale MQX 4.1\demo\web_hvac\RTCS.c file.
/* runtime RTCS configuration */
_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;
I hope this helps.
Best regards,
Carlos
Technical Support Engineer