A small RPC implementation.
- Fast , although limited by system call select , every 512 request will be finished in about 80 milliseconds. Which is way more than enough for small network or embedded device.
- Small , the library on Linux with -Os , the size of it is less than 70KB.
- Self contained library , the library doesn't require any third party and is strictly compatible with Linux/Windows and also ANSI C standard.
- Simple, no rocket science here. Just absolute minimum and intuitive function , no IDL generation , only ANSI C is needed here.
- Easy to use, to set up a server, the user just needs to know 4-5 API then you could have a single IO thread with multiple backend thread pool architecture ; for client user ,only 1 API is needed.
- Efficient, wire protocol is entirely binary based, integer is encoded using Base128 , and string is encoded as slice. Overhead per packet is very small.
Issue a request on client:
API:
int mrpc_request( const char* addr, int method_type , const char* method_name ,
struct mrpc_response* res , const char* par_fmt , ... );
Code:
// Suppose we have a Add function register on server
struct mrpc_response response;
mrpc_request("127.0.0.1:12345",MRPC_FUNCTION,"Add",
&response,"%u%u",1,2);
printf("1+2=%d",response.result.value.uinteger);
Set up a server with multiple service:
See server.c for detail
- Linux
- Windows
MIT