Hi,
I am using CC3200SDK_1.1.0.
I have written http webserver. Below is the sample code
SlSockAddrIn_t local_addr;
uint32_t non_blocking = 0;
SlSockAddr_t s Addr;
SlSocklen_t iAddrSize;
int16_t socket_fd;
int16_t new_socket_fd;
//filling the TCP server socket address
local_addr.sin_family = SL_AF_INET;
local_addr.sin_port = sl_Htons(80);
local_addr.sin_addr.s_addr = 0;
char buffer[1024] = {0};
socket_id = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
sl_Bind(socket_id, (SlSockAddr_t *)&local_addr, addr_size);
sl_Listen(socket_id, 1);
sl_SetSockOpt(socket_id, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &non_blocking, sizeof(non_blocking));
while(1)
{
new_socket_fd = sl_Accept(socket_id, ( struct SlSockAddr_t *)&sAddr, (SlSocklen_t*)&iAddrSize);
sl_Recv(new_socket_fd, buffer, 1024, 0);
sl_Send(new_socket_fd, "Success", strlen("Success"), 0);
sl_Close(new_socket_fd);
}
Some times I used to get "[SOCK ERROR] - close socket (21) operation failed to transmit all queued packets" error. and client doesn't receive any response and continues to be in wait state. It is not every time I get this error. It's rare but it happens maybe once in 500 requests and it causing my client to be blocking state.
Can you please advice how can i handle this rare exception? I tried putting delay between sl_Send() and sl_Close() but didn't succeed.