Go Down

Topic: UDP Write anomaly (Read 892 times) previous topic - next topic

PeterH


if I try to send "Hi" to device 1 and "Hello" to device 2 and neither one is online, when one of the receiving devices comes online and it tries to send a new packet to it containing "What", it would send "HiHelloWhat".


You're saying that if you submit a packet to one device when it is offline, the shield will subsequently send that packet to a completely different device? That sounds horrendous, and I'd want to look for ways your experiment may have produced misleading results. Is each packet in that test definitely submitted to the shield by the normal sequence of begin packet, write data, end packet?

If you have time to test it with Wireshark or equivalent, I'd be interested to know whether the shield is sending one large UDP datagram containing all the buffered data (from all immediately preceding failed send attempts) or is sending each of the buffered packets in a separate datagram.
I only provide help via the forum - please do not contact me for private consultancy.

eddy9

#6
Jan 15, 2013, 03:52 pm Last Edit: Jan 15, 2013, 03:54 pm by eddy9 Reason: 1
Quote
You're saying that if you submit a packet to one device when it is offline, the shield will subsequently send that packet to a completely different device? That sounds horrendous


I think what is happening is that the shield does not clear the write buffer when a packet is not delivered. So every subsequent undelivered packet gets appended to the buffer (rather than overwrite it). When the next packet is delivered successfully, the shield would send all of the contents of the buffer and then clear it to get ready for the next packet. I haven't looked at the Ethernet libraries to verify this but it sounds a reasonable explanation. Any comments?

PaulS

Quote
I haven't looked at the Ethernet libraries to verify this but it sounds a reasonable explanation.

It does, but, why doesn't beginPacket() clear that crap out? It appears as though there is a separate buffer for each node being communicated with.

PeterH


It appears as though there is a separate buffer for each node being communicated with.


Even worse, if it have understood the symptoms correctly, it appears that there is a common buffer shared between all nodes. I can't think of any scenario in which a datagram correctly submitted for transmission to one node should reasonably be sent to a different node.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up