You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Cap'n Proto
Hello world,
I am new to capnp. I want to know whether we can implement two servers in capnp. The requirement is to reduce number of polling in the communication. If we have a client, it seems to be we have to poll many times, which can affect runtime. Is there anyway I can acheive this. Are there ant example codes available?
Thanks
Kenton Varda
unread,
Dec 24, 2018, 3:39:29 PM12/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Omega Ishendra, Cap'n Proto
Hi Omega,
Sorry, I don't understand your question.
Cap'n Proto RPC uses an event loop concurrency model. "Polling"
shouldn't ever be necessary.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Cap'n Proto
Sorry for the unclearness.
In short what I want to know is,
I know that we can have multiple clients.
Can we have two severs in capnp?
If it is yes, Is there any example code available which I can refer?
Thanks, Omega
Kenton Varda
unread,
Dec 27, 2018, 1:40:54 PM12/27/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Omega Ishendra, Cap'n Proto
Yes, you can have as many servers as you want. In fact, once connected, Cap'n Proto doesn't know the difference between a client and a server -- either side can send messages to the other equally. Cap'n Proto is designed as a peer-to-peer protocol; any notion of client or server happens at the application level.
The only catch here is that sometimes people write Cap'n Proto "client" code by calling promise.wait() to synchronously wait for promises to complete. When you have multiple calls happening concurrently (as you would when there are multiple servers), you can't do that -- you have to use .then() to register callbacks to call when the promise completes. (This applies to the C++ library -- the details may be a bit different in other languages.)