I found a strange problem related to Nagle-algorithm but possibly caused by host operating system. My application is as follows:
- host sends payload data to my lwIP-driven device in packets of 1460 bytes
- host sends state-requests to this device in packets of 3 bytes
- device sends state-response in packets of 40 bytes to host (which is waiting for them asynchronously, means receiving is done in an own thread)
Since all these packets have to be handled as fast as possible, I disabled Nagle on both ends (TCP_NODELAY on host side and tcp_nagle_disable() on device side).
Now there is a situation where host sends state-requests (3 bytes) to device quite fast. Under Linux host is able to receive the related state-response (40 bytes) wihtout problems, unter Windows at some point no more data are received, it seems disabled Nagle-algorithm seems to stall the receiving-side when many packets are sent. From device-side it seems it is not possible to send these data (means even to queue them). Since it works smoothly with Linux I think that happens because Windows no longer accepts any packets so that the lwIP-internal buffer becomes full at some point.
My current - really ugly - solution is to have a delay of at least 10 msec after submission of every send-request. This lets Windows receive the response without problems.
My question: did anybody notice such a behaviour? Is there anything I can do to avoid this and to enforce lwIP to send the response also when there are many packages received?