RPC between Rust and C

I am working on developing a module that has to do lot of RPC with other systems implemented in C. My first preference would be gRPC but the as far I know gRPC doesn't have first class support for C.

Looking for suggestions for a high performance RPC between Rust & C. Appreciate any pointers.


I don't know a lot about this, but I do know that both rust and C have nicely working messagepack implementations. Maybe look into that :slight_smile:

Use zeromq, it have good C library .

It is very simple and high performance message broker, just send meesage over socket

Also support request/reply pattern

I use ZeroMQ for this sort of thing. You can do strictly ordered request/reply, or interleaved request/reply (using router sockets), or fully bidirectional (using dealer sockets). Works well in C and Rust, which is what I use it for. The C bindings are excellent.

There's almost zero difference between running sockets over IPC on a local machine, or TCP on different machines. Indeed right now, I'm debugging an embedded UI by running it on a desktop machine, while it uses ZeroMQ via TCP to talk to the hardware layer and other services on an embedded device. In normal deployment it runs on the same device using IPC sockets instead. That all required one line changes for each socket, and nothing else in any other part of the code.

It doesn't give you a higher level protocol for arguments/return values though, it's up to you to decide exactly what format your messages take. I use Cap'n Proto for that, others use Protobuf or JSON.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.