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.)

-Kenton

On Tue, Dec 25, 2018 at 8:32 PM Omega Ishendra <[email protected]>
wrote:

> 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
>
> On Tuesday, December 25, 2018 at 2:09:29 AM UTC+5:30, Kenton Varda wrote:
>>
>> 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.
>>
>> -Kenton
>>
>> On Sun, Dec 23, 2018 at 8:47 PM Omega Ishendra <[email protected]>
>> wrote:
>> >
>> > 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
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Cap'n Proto" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > Visit this group at https://groups.google.com/group/capnproto.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to