LwIP echoclient RAW example comments
I wish this thread could be a community documentaiton to analyze and understand LwIP RAW echoclient example provided in firmware packages. It would be nice to open new threads for each example.
First question regarding this example: in tcp_echoclient_recv why the code tries to send remaining data if remote socket was detected as closed? It makes no sense to me. Any clue?
/* if we receive an empty tcp frame from server => close connection */
if (p == NULL)
{
/* remote host closed connection */
es->state = ES_CLOSING;
if(es->p_tx == NULL)
{
/* we're done sending, close connection */
tcp_echoclient_connection_close(tpcb, es);
}
else
{
/* send remaining data*/
tcp_echoclient_send(tpcb, es);
}
ret_err = ERR_OK;
}
Thanks
