LWIP STM32 - server example

Thread Starter


Joined Dec 28, 2021
I implemented lwip echo server sample on my nucleo stm32f767 board.
everything works as expected.

I am trying to send data from the server to the client using tcp_write() not as a response for a request from the client. (asynchroniously)
it means I have copied the "tpcb" to a global variable.
it works but some times the reviced data is copied to the transmit buffer. (see function below which is called when my data is ready)
can someone provide the correct way to do it ?

void tcp_server_send_async(uint8_t * payload, uint16_t size)
/* enqueue data for transmission */
if(size < tcp_sndbuf(g_es->pcb))