Advertisement

Network Library that supporst RPCs

Started by April 27, 2016 12:17 AM
19 comments, last by teremy 8 years, 6 months ago

Thank you guys, again, very helpful information!

If every an argument has a fixed size, then it sure is easy. A string for example doesn't really have a fixed size, although since I know it is a string, I could look for the null character ( '\0' ), or just send a length byte first.

I was thinking of using MsgPack, which for example will have an output less in size with a small integer as with a large integer. So the result depends on the actual value, not just the type.

The mentioned SQLite4 varint encoding and VLQ encoding would allow the receiver to guess the size of the parameter by the encoding, right? So I don't have to prepend a length byte, but the encoding will tell which bytes belong to the parameter.

This sounds very good to me, so it contains the length information in the information itself. Although I guess having 1 byte extra ( for length ) for each argument, is still efficient and it lets me send an integer like 10 with only 2 bytes( length byte + byte for the value ), instead of 4.

This knowledge should really lead to an efficient RPC implementation, as I will probably use an efficient serialization method.

Can't thank you enough for your time and effort to help me, you are the best!

EDIT: https://gist.github.com/frsyuki/2908191

This site even mentions RPC as a use case for MsgPack :). Good thing I can easily switch the serialization method, but with MsgPack I guess I'll have an efficient way of storing data.

This topic is closed to new replies.

Advertisement