updated README to explain the connection::expected() method

This commit is contained in:
Emiel Bruijntjes 2016-06-15 15:07:32 -04:00
parent 3d9b5b444b
commit 2a0b0de409
1 changed files with 8 additions and 0 deletions

View File

@ -246,6 +246,14 @@ with a buffer filled with the remaining 40 bytes. If the method returns 0, you s
make a new call to parse() when more data is available, with a buffer that contains
both the old data, and the new data.
To optimize your calls to the parse() method, you _could_ use the Connection::expected()
and Connection::maxFrame() methods. The expected() method returns the number of bytes
that the library prefers to receive next. It is pointless to call the parse() method
with a smaller buffer, and it is best to call the method with a buffer of exactly this
size. The maxFrame() returns the max frame size for AMQP messages. If you read your
messages into a reusable buffer, you could allocate this buffer up to this size, so that
you never will have to reallocate.
TCP CONNECTIONS
===============