I need to repetitively send 4 bytes, 00 00 00 F6
, every two seconds.
BUT, IdUDPClient.SendBuffer
does not return after transmission.
I try sending a few more bytes, and it returns every time.
This works:
UDP.SendBuffer(RawToBytes(#0 + #0 + #0 + #1 + #127 + #128 + #246, 7));
This does not work:
UDP.SendBuffer(RawToBytes(#0 + #0 + #0 + #246, 4));
I have unsuccessfully tried many of the suggestions I have found in various related StackExchange questions.
I have seen at least three scenarios:
- Hanging, Wireshark sees 1 transmission.
- Working repetitive transmissions, but NOT with 4 bytes of data.
- Sometimes bytes >
7F
are sent as3F
.
Can someone point out what I am doing wrong?
Edit: The above happens in a thread. If the TIdUDPClient
is put as a visible component on a form, then it works fine.
Could this be a threading/reentrancy issue???