We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 61298

Vivado 2014.2 LwIP – tcp_write() returns ERR_MEM when trying to transfer a large amount of data 


I am trying to transfer 20000 bytes of data via tcp_write().

However, tcp_write() returns an ERR_MEM error.
I am using the following settings for lwIP:
tcp_wnd 65535
tcp_snd_buf 60000
tcp_mss 20000
What is the cause of this error?


The tcp_write() function will fail and return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of the outgoing segment is larger than the upper limit defined in lwipopts.h.

This is per the rawapi.txt file located in "C:\Xilinx\SDK\2014.2\data\embeddedsw\ThirdParty\sw_services\lwip140_v2_1\src\lwip-1.4.0\doc\"

The number of bytes available in the output queue can be retrieved with the tcp_sndbuf() function.
If you receive the ERR_MEM error you have two choices:
  1. Try again but send less data.
    You can use tcp_snd_buf() to find out how much space is available.
  2. Wait until later when there is more space available.
    You can use tcp_sent() to request a callback when there is more space. 

AR# 61298
Date 09/16/2014
Status Active
Type General Article
  • Zynq-7000
  • Vivado Design Suite - 2014.2
Page Bookmarked