fredag 23 oktober 2020 kl. 07:39:55 UTC+2 skrev mike:
Hi,
I am working with NETCONF implementation in java and in this RFC https://tools.ietf.org/html/rfc6242#page-5 there is a framing protocol called "Chunked Framing Mechanism".
I have messages already in byte [] format.
Anyone worked with chunked messages and how to implement them. How do I set the size of the chunk?
All hints and support is greatly appreciated.
//mike
I was thinking to read the whole message, byte [] into
ByteArrayInputStream in = new ByteArrayInputStream(data);
byte[] buffer = new byte[1024];
Then I create a buffer of specific size representing the chunk.
"Chunked-Message = 1*chunk
end-of-chunks
chunk = LF HASH chunk-size LF
chunk-data
chunk-size = 1*DIGIT1 0*DIGIT
chunk-data = 1*OCTET
end-of-chunks = LF HASH HASH LF
DIGIT1 = %x31-39
DIGIT = %x30-39
HASH = %x23
LF = %x0A
OCTET = %x00-FF
"
If I now read from "ByteArrayInputStream" into buffer:
int length = in.read(buffer);
Then I have the length of the "chunk"
So how can I append data to the chunk, according to above?
I mean when I have an byte [] ?
//mike
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)