# Client server communication using ZeroMQ

**URL:** https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724
**Category:** Show & Tell
**Created:** [July 27, 2023, 1:28pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724 "2023-07-27T13:28:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mpuskaric](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mpuskaric](https://openfhe.discourse.group/u/mpuskaric)
#### Post date: [July 27, 2023, 1:28pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724/1 "2023-07-27T13:28:40Z")

</div>

Hello, I thought I’d share a simple example [1] of client server communication using ZeroMQ networking library. I am not an expert programmer, so the code might not be the most efficient one. More information is available in the readme file also available under [1]. Comments are welcome

[1] [https://github.com/mpuskaric/zeromq-openfhe](https://github.com/mpuskaric/zeromq-openfhe)

---

<div class="post-metadata">

### Author: ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)
#### Post date: [July 28, 2023, 4:57pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724/2 "2023-07-28T16:57:13Z")

</div>

This is very cool!

I’d love to hear more about the design decision(s). What made you choose ZeroMQ as opposed to some other library?

---

<div class="post-metadata">

### Author: ![mpuskaric](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mpuskaric](https://openfhe.discourse.group/u/mpuskaric)
#### Post date: [July 30, 2023, 4:15pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724/3 "2023-07-30T16:15:57Z")

</div>

Thanks, I appreciate it.

I was basically searching for a library which would help me build a federated analysis model similar to [1]. The two essential requirements for me were ease of use and support for TLS. During the research, I considered RabbitMQ, gRPC and Boost Asio libraries. ZeroMQ feels like one step above socket programming (such as with Boost Asio) and I would say it is also easier to use it. Moreover, TLS is supported as well and is explained in detail in [2]. RabbitMQ supports more advanced features, such as message persistence, but I had no plan to utilize them for my framework. It seems that many federated analysis/learning frameworks use RPC/gRPC (Flower, PySyft, OpenFL, TensorFlow Federated, FATE), these seem to be, however, more focused on a star network topology with a clear distinction between client and server roles.

I still haven’t had a chance to test ZeroMQ’s (or generally Message Queue) ability to send larger data (ciphertext, keys) when processes are running on different servers and with the presence of latency and limited network bandwidth. Running multiple processes on a single server proved to be very reliable.

[1] [Truly privacy-preserving federated analytics for precision medicine with multiparty homomorphic encryption | Nature Communications](https://doi.org/10.1038/s41467-021-25972-y)  
[2] [Using ZeroMQ Security (part 2) - Hintjens.com](http://hintjens.com/blog:49)

---

<div class="post-metadata">

### Author: ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)
#### Post date: [July 30, 2023, 4:40pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724/4 "2023-07-30T16:40:15Z")

</div>

You might be interested in checking out [Palisade-Serial-Examples](https://gitlab.com/palisade/palisade-serial-examples)! I know that @dcousins did/ does quite a bit of work with client-server stuff.

@ypolyakov should we introduce a section on the RTD showcasing particularly interesting projects? I can think of one other that might be worth highlighting (assuming @mpuskaric and that user are fine having their projects showcased)

---

<div class="post-metadata">

### Author: ![mpuskaric](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mpuskaric](https://openfhe.discourse.group/u/mpuskaric)
#### Post date: [July 30, 2023, 9:07pm UTC](https://openfhe.discourse.group/t/client-server-communication-using-zeromq/724/5 "2023-07-30T21:07:51Z")

</div>

> [@iquah](#):
>
> You might be interested in checking out [Palisade-Serial-Examples](https://gitlab.com/palisade/palisade-serial-examples)! I know that @dcousins did/ does quite a bit of work with client-server stuff.

thanks for the reference, these are excellent examples, I learned a lot from them.

> [@iquah](#):
>
> (assuming @mpuskaric and that user are fine having their projects showcased)

No objections from my side.
