LWIP STM32 - server example

Thread Starter

royazriel1

Joined Dec 28, 2021
1
I implemented lwip echo server sample on my nucleo stm32f767 board.
everything works as expected.
https://controllerstech.com/wp-content/uploads/2021/09/TCPServerRAW.zip

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))
{
tcp_write(g_es->pcb,payload,size,1);
}
}
 
Top