- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I just modified the tcp_server app
1. Once connected listens for data until disconnected from client side
2. Removed the echo back , prints the rxd pkt size only
I'm transmitting packets of 1K size to the server continuously without delays , and after some time ,say 30 sec , I see my server gets crashed and Platform gets restarted,
This behavior is only in Wiced SDK 3.1.0 but working OK in Wiced SDK 2.4.1 , But I can't use SDK 2.4.1.
How can I solve this issue? Do I require some patches to solve this problem?
static wiced_result_t tcp_server_process( tcp_server_handle_t* server, wiced_packet_t* rx_packet )
{
char* request;
uint16_t request_length;
uint16_t available_data_length;
wiced_packet_get_data( rx_packet, 0, (uint8_t**) &request, &request_length, &available_data_length );
WPRINT_APP_INFO(("%d\n", request_length)); /* just prints the length of xrd packet*/
return WICED_SUCCESS;
}
static void tcp_server_thread_main(uint32_t arg)
{
tcp_server_handle_t* server = (tcp_server_handle_t*) arg;
while ( quit != WICED_TRUE )
{
wiced_packet_t* temp_packet = NULL;
wiced_result_t result = wiced_tcp_accept( &server->socket );
if ( result == WICED_SUCCESS )
{
while(1)
{
if (wiced_tcp_receive( &server->socket, &temp_packet, WICED_WAIT_FOREVER ) == WICED_SUCCESS)
{
/* Process the client request */
tcp_server_process( server, temp_packet );
/* Delete the packet, we're done with it */
wiced_packet_delete( temp_packet );
}
else
{
wiced_tcp_disconnect( &server->socket );
break;
}
}
}
}
WPRINT_APP_INFO(("Disconnect\n"));
WICED_END_OF_CURRENT_THREAD( );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think that you missed function call tcp_packet_delete
Hi
try this sample for your information
//-----------------------------------------------------------------------------
static wiced_result_t tcp_server_process( tcp_server_handle_t* server, wiced_packet_t* rx_packet )
{
char* request;
uint16_t request_length;
uint16_t available_data_length;
wiced_packet_get_data( rx_packet, 0, (uint8_t**) &request, &request_length, &available_data_length );
WPRINT_APP_INFO(("%d\n", request_length)); /* just prints the length of xrd packet*/
//----------------------- add this code -----------------------------------------------------------------------------
wiced_packet_delete(rx_packet); // delete packet data(alloced memmory )
//-------------------------------------------------------------------------------------------------------------------------
return WICED_SUCCESS;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But as you can see that the packet gets deleted after calling the function tcp_server_process()
if (wiced_tcp_receive( &server->socket, &temp_packet, WICED_WAIT_FOREVER ) == WICED_SUCCESS)
{
/* Process the client request */
tcp_server_process( server, temp_packet );
/* Delete the packet, we're done with it */
wiced_packet_delete( temp_packet );
}
So I assume this is enough to deallocate the alloacated memory for TCP packets.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I missed,
how about "tcp_server_thread_main" stack size ?
Then try "making thread stack_size", WICED seems to use more stack in network applicaiton.
TKS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Discussion is being locked. If you have any follow-up questions, please start a new discussion.