Unix Domain Socket on Windows for gRPC connection

Hello Rust community,
[IPC, Windows, NamedPipes, UnixDomainSockets]
I'm very new to Rust and I am currently working on an App, which in future should work on all 3 major platforms [windows, mac, and linux]. One component of the app is the UI using Tauri, and this component should work as a gRPC client which should connect to a Unix Domain Socket created by other process, and should create a bidirectional communication channel. I was able to implement this using tokio, and tonic crates for mac/linux.

My issue is working with windows: in using uds_windows crate to get UnixStream, as the implementation

  1. UnixStream::connect Does not return a Future which seems like an easy enough work around
  2. after I make a work around for 1, UnixStream doesn't implement AsyncRead and AsyncWrite of tokio::io (i think) which is needed for gRPC client building using tonic.

Then I saw Unix Domain Sockets on Windows · Issue #271 · rust-lang/libs-team · GitHub , so looks like named pipe is the way to go. So I used tokio::net::windows::named_pipe but ran into similar issue while creating gRPC client.
I also came across this issue which is still open where someone is facing the similar issue to implement the same custom traits. How to implement an async read/write incoming stream with tokio named pipe? · Issue #1518 · hyperium/tonic · GitHub

What is the best way forward, could someone suggest a documentation specific to IPC on windows using UDS or NamedPipe? Or what am I doing wrong?

Appreciate your help!

Is TCP or UDP over the loopback adapter an option?

Thanks for the reply!
I wanted to know if someone went along the path of implementing custom wrapper around uds_windows::UnixStream, so that I can take pointers. This is challenging on my own given my knowledge of Rust at the moment. I was really hoping someone will suggest my research is wrong and hence the correct path forward :smiley:

If I don't get a path forward, I will need to consider using TCP sockets just for windows.

1 Like

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.