automatic send using starterware/enet_lwip/enet_echo

Dear All,

I have an application, which requires following behaviour: when a client opens a socket to the beaglebone, the beaglebone starts
periodically send data (up to 40KiB per transmission with period of
rougly 700ms).

So I have used starterware and started to tweak enet_lwip and enet_echo
to get what I want: HTTP + socket communication. I have used main() to
process my data and use tcp_write and tcp_output from main().

Now the stuff is, if I send small chunks of data (e.g. 300bytes),
everything works as expected. If however I try to send more than say
20KiB, the things go really wrong: I cannot send such amount of data
(even if sndbuf size seems OK), I experience huge amount of lost packets
and at certain moment the thing completely breaks.

I’ve read somewhere, that LWIP without OS is used as
‘singlethreaded’. Implementation of TI enet_lwip is interrupt
driven. Hence I get the packet, and inside the same RX interrupt routine
I invoke tcp_write to send a reply (this is what enet_echo does).

Such behaviour seems to be ok, problem is, that in my case the beaglebone should be the
one who initiates the send. If the ‘interrupt’ kind of work is true
(i.e. I cannot use tcp_write outside of RX lwip interrupt), it means
that I cannot invoke tcp_write from main(), but I have to run this
somehow from within LWIP framework.

Has anyone solved that issue?

Additional trouble is, that if I tweak enet_lwip (or the other) to
contain tcp_poll function, this one gets never called. (this was my
first test: i wanted to send it from poll function to assure that I am
inside lwip thread, but no success).

It seems that TI version of LWIP handling is quite problematic for
‘server’ side use, i.e. the actions triggered by beaglebone. And I don’t
know how to get out of this trouble… One of the options would be to
re-write lwip handling as main and not interrupt driven. but that does
not look like easy job

any hint kindly appreciated