- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I am trying to send a rather large packet over TCP in AP mode. The packet varies anywhere between 1400 to 1800 bytes. When I give this length to "wiced_packet_create_tcp", it sometimes returns the "available_space" parameter with a value smaller than my packet size.
What does this mean? Does it mean I have to split up my packet or is it dependent on any other memory?
Has my application occupied so much memory that the TCP stack is unable to find any more memory?
I am using WICED 3.3.1 with (FreeRTOS + LwIP) on an MXCHIP EMW3162 module with STM32 and BCM43362A2.
Sample Code: (Function from my end responsible for sending packets).
if ((result = wiced_packet_create_tcp( socket, strlen (response), &tx_packet, (uint8_t**) &tx_data, &available_data_length )) != WICED_SUCCESS )
{
MYLOG("TCP packet creation failed, %d", result);
return WICED_ERROR;
}
if (available_data_length >= strlen(response)) {
MYLOG (" Not enough memory available for sending data ");
return WICED_ERROR;
}
Thanks in advance for the help.
Best Regards,
Avinash
Message was edited by: Avinash Kumar The title could have been better framed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That platform has only 128k or sram
So it is possible that there isn't enough packet memory available at that moment
You can profile your memory usage using mallinfo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nsankar wrote:
That platform has only 128k or sram
So it is possible that there isn't enough packet memory available at that moment
Hi nsankar,
In this case wiced_packet_create_tcp() returns success.
The question is what is the graceful way to handle the case "available_space"
is small than the packet size to send?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to break up the packet in application space rather than in the TCP stack in this case. And send via multiple TCP packets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
avinashckumar.switch wrote:
Hi All,
I am trying to send a rather large packet over TCP in AP mode. The packet varies anywhere between 1400 to 1800 bytes. When I give this length to "wiced_packet_create_tcp", it sometimes returns the "available_space" parameter with a value smaller than my packet size.
What does this mean? Does it mean I have to split up my packet or is it dependent on any other memory?
Has my application occupied so much memory that the TCP stack is unable to find any more memory?
Hi avinashckumar.switch,
I think you can take a look at the implementation of wiced_tcp_send_buffer() to see how it handles this case.
Or just switch to use wiced_tcp_send_buffer() instead of wiced_packet_create_tcp().
Regards,
Axel