Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Atheros on August 30, 2011, 03:34:31 AM



Title: Exception 'CDataStream::read() : end of data' caught
Post by: Atheros on August 30, 2011, 03:34:31 AM
I'm having a great deal of difficulty interacting with the Bitcoin client according to the Protocol Specification. I'm concerned something is wrong.

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:

Quote
sending: addr (811 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


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.

Quote
received: verack (0 bytes)
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.