Replies: 1 comment
-
Yes, this is supported, and is one of the defining features of Cap'n Proto. No, you do not need multiple threads or multiple event loops. The client implements the relevant interface using exactly the same code you'd use on the server. That is, you implement The calculator example includes a demonstration of this with the https://github.com/capnproto/capnproto/blob/v2/c%2B%2B/samples/calculator.capnp#L87 https://github.com/capnproto/capnproto/blob/v2/c%2B%2B/samples/calculator-client.c%2B%2B#L29 https://github.com/capnproto/capnproto/blob/v2/c%2B%2B/samples/calculator-client.c%2B%2B#L362 |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm just getting started with Cap'n Proto and I think I'm getting a handle on the basic operation, but I'm having trouble figuring out how to have a single program be both an RPC client and a server in C++. The program implements a server, but it starts as a client and calls a method on the server which returns a secondary interface. The client then calls a method on this secondary interface and passes its own interface (for which it is the server) to the original server. My two machines each have an interface to the other. How would I implement such a scheme? Do I need two event loops on separate threads? Or can it somehow be accomplished with a single event loop? Thanks for any assistance you can give.
Beta Was this translation helpful? Give feedback.
All reactions