We have a strange problem with Indy10, where two large lines (several hundred characters each) that we send one after another using TCP appear on the other end, weirdly intertwined. This is extremely rare.
Each line is a complete XML message completed by LF, and in general, the READ process reads the whole XML message, returning when it sees LF.
The call to actually send the message is protected by the critical section around the call to the IOHandler writeln method, and therefore it is not possible to send two streams at the same time. (We are sure that the critical section is implemented / working correctly). This problem is very rare. The symptoms are odd ... when we send line A, followed by line B, which we received at the other end (in rare cases, when we have a failure), is the final part of line A by itself (i.e. there LF at the end of it), followed by the leading section of row A, and then the entire row of B, followed by a single LF. We checked that the "timed out" property is not true after a partial read - we register this property after each read that returns the contents. In addition, we know that there are no built-in LF characters in the string, since we explicitly replace all non-alphanumeric characters in the string with spaces before adding LF and sending it.
We have log mechanisms inside critical sections at both ends of the transmit and receive, and therefore we can see this behavior on the βwireβ.
We are completely baffled and wonder (although it is always the lowest opportunity) if there can be some low-level Indy problems that can cause this problem, for example, buffers are sent in the wrong order ... it is very difficult to believe this may be a problem, but we grab the straw.
Does anyone have any bright ideas?
delphi delphi-2007 indy indy10
Jim
source share