Hi,

I have an implementation using lwIP on a TI TMS570LC4357 LaunchPad which
exhibits a strange problem, and I'm hoping someone can provide some insight
or tips :)

1. The first message received calls tcp_recv instantly and is processed.

2. The second message might take 5 - 10s until tcp_recv is called.

3. The third etc. can take a very long time (or forever) between sending
the data to the TMS570 and the getting callback.

My code is based on this echo-server:
https://github.com/dreamcat4/lwip/blob/master/contrib/apps/tcpecho_raw/echo.c

Note that in the initial implementation of the echo server this problem
doesn't occur, however, my implementation separates reading and writing
(e.g. it is not an echo server anymore). So on reading, the message is
parsed/stored, then instead of sending it back the pbuf is freed and
tcp_recved called. If I insert a tcp_write after I have stored the message
and just send some random (constant) string back before I deallocate the
pbuf - everyone works once more (there is no delay on receiving subsequent
packets). I struggle to explain why this is the case. Does anyone see a
problem with the echo server code that would make it stop working if it's
not being asked to send data?

It seems almost a little like this:
https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/675413?RM46L852-Modbus-Over-TCP-IP-control-hand-in-TCP-Rx-interrupt


I have attached my code. Note that in the function cont_read, if I remove
the line "tcp_write(tpcb, "ACK", 3, 1);", I start getting the extreme
delays before receiving subsequent messages.

Thanks,

Thomas Drage

Attachment: echo_mod.c
Description: Binary data

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to