Suppose I connect to my Bitcoin client using a custom program written in Python. Suppose when I receive an addr message from the client, I repeat the entire thing back two or three times. This should work fine, right? This is what the debug.log of the Bitcoin client shows:
received: addr (811 bytes)
ProcessMessage(addr, 811 bytes) : Exception 'CDataStream::read() : end of data' caught, normally caused by a message being shorter than its stated length
ProcessMessage(addr, 811 bytes) FAILED
PROCESSMESSAGE SKIPPED 4 BYTES
received: addr (811 bytes)
ProcessMessage(addr, 811 bytes) : Exception 'CDataStream::read() : end of data' caught, normally caused by a message being shorter than its stated length
ProcessMessage(addr, 811 bytes) FAILED
PROCESSMESSAGE SKIPPED 4 BYTES
received: addr (811 bytes)
ProcessMessage(addr, 811 bytes) : Exception 'CDataStream::read() : end of data' caught, normally caused by a message being shorter than its stated length
ProcessMessage(addr, 811 bytes) FAILED
The log also shows that verack and getaddr messages SOMETIMES aren't processed by the client correctly even though I always send the same message to the client.
ProcessMessage(verack, 0 bytes) FAILED
received: getaddr (0 bytes)
ProcessMessage(getaddr, 0 bytes) FAILED
I've verified in Wireshark that the addr message being repeated by my program (and received by the client) are identical to the ones that the client sent out.