Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

New Contributor II


I made a tcp server with callbacks with as an example the build in HTTP server.

But sometimes it seems that a callback is missed, and data gets delayed.

This seems to happen when much data is send at once.

I already added some code in the thread where the message is popped from the queue to keep reading until nothing is received anymore, like this:




                    recvResult = wiced_tcp_receive( current_event.socket, &packet, WICED_NO_WAIT );

                    if(recvResult == WICED_SUCCESS)


                        if ( packet != NULL )


                            ttl_server_parse_packet(current_event.socket , packet, &close_request);

                            wiced_packet_delete( packet );

                            if ( close_request == WICED_TRUE )


                                wiced_tcp_server_disconnect_socket( &server->tcp_server, current_event.socket );






                } while(recvResult == WICED_SUCCESS);


So the TCP message seems to be stuck in the system until I send an other one, then the previous message is handled and that keeps going on like that.

Does anyone had issues with the socket callbacks as well, or a pointer why this might go wrong.

Or is there maybe  a better way to support multiple socket connections?

1 Reply
New Contributor II

I solved it now by ignoring the message received callback.

I am still using the callback for connect and disconnect.

When I receive a connect I accept the socket and then create a thread for this client, which continuously waits for data, and this seems to get it all and work faster than the callback.

When disconnect is called using the callback, the receive socket already detected it is closed and the thread executes WICED_END_CURRENT_THREAD. On the place I fetch the disconnect callback I then delete the thread that I created for the client to receive data.

This approach solves the above problem for me, maybe it is useful for someone else as well.