-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unix Domain Sockets on Windows #271
Comments
I recommend giving this issue a more meaningful title |
The windows version of AF_UNIX only supports a subset of what most (all?) unixes support. So we have to be careful to not reduce ourselves to a lowest common denominator that's lower than what's already supported across unixes. |
I think this needs some design work. Like should there be a common subset Maybe fully answering those question can be deferred until after an initial implementation. |
Oeps, thought I already filled in a title 😅 I agree that it depends on the feature set, and you don't want to limit other platforms if Windows doesn't support something. I don't mind to help work on this issue, though I don't have much Rust experience, let alone it's standard library... As for other non-posix OS that don't support UDS, I don't think there is one on the Tier 1 support list. |
I am no windows expert.. I just stripped https://github.com/Azure/mio-uds-windows to the relevant parts. You should ask there. But maybe it's all coming from https://github.com/yoshuawuyts/miow |
@alexcrichton seems to have been a major contributor to |
Putting these types into Some rough thoughts:
|
Having a common cross-platform type would be very useful. Yes it would be limited to a common subset but that's fine. Otherwise the user will need both |
I think this might be required due to the presence of Windows-incompatible inherent methods on the Hopefully code that only uses the common subset could do something like this: #[cfg(windows)]
use std::os::windows::net::{UnixListener, UnixStream};
#[cfg(unix)]
use std::os::unix::net::{UnixListener, UnixStream};
// can now refer to `UnixListener` and `UnixStream` without `cfg`, so long as only
// common API is used. |
@jmillikin: Correct me if I’m wrong, but looked over this in not too much detail the only stable inherent method on the current UnixListener/UnixStream structs that does not have a direct Windows counterpart is the The |
Do you want to guarantee forever that the API surface of UDS sockets on Unix and UDS sockets on Windows will stay largely identical? I wouldn't feel comfortable making the Rust standard library assert that guarantee. Using separate structs (even with largely similar API) lets the OS-specific behavior drift over time as necessary to match updates from the OS vendor. Regarding
|
We discussed this in the libs-api meeting and we're happy to add this as a Windows-specific API under |
Proposal
Problem statement
Currently Unix Domain Sockets (UDS) are only supported on Unix systems.
However, unlike the name suggests, they have been available on Windows as well ever since Windows 10 Insider Preview Build 17063 in 2017.
There is a crate that adds Windows UDS functionality, but having the split from the std (linux/mac) UDS and Windows crate causes some issues.
The biggest pain point is tokio/mio which many other crates rely on and
One such crates is Deno, which has UDS support available on Linux under a unstable flag due to this problem.
There are many more, some can be seen referencing this issue.
Motivating examples or use cases
With the current implementation UDS is effectively limited to Linux/Mac only.
While it can be a great tool for Inter Process Communication (IPC).
One example use case I personally wanted to try was high throughput communication between Deno and WebView.
Many projects now rely on things like named pipes, or just forgo the idea of supporting Windows.
Adding Windows support could spread the use of UDS as a method for IPC not only on Windows but also Linux as crates no longer have to choose between cross-platform support or UDS.
Solution sketch
The challenges for a solution can best be described with a couple of questions
Why has there not been a solution yet?
From what I gathered it seems like Windows 7/8 have been the blocking factor, both not supporting UDS and being a Tier 1 supported platforms.
As this will no longer be the case with Rust 1.76, maybe that is a good moment to introduce UDS with Windows support.
Are there major difference between the platforms UDS implementations?
This is something I am not knowledgeable in, contacting the contributors behind uds_windows could shed some more light on this.
So a solution could look like an UDS Windows implementation that is released with Rust 1.76.
If there aren't any breaking difference I would propose to make it available under the same API.
The work from uds_windows could be used as a reference, maybe some of the contributors could help upstream the implementation.
Alternatives
Don't implement Windows UDS into the standard library.
Though this will be confusing, especially once Windows 7/8 is dropped as a Tier 1 platform.
Links and related work
What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals as capability becomes available. Current response times do not have a clear estimate, but may be up to several months.
Possible responses
The libs team may respond in various different ways. First, the team will consider the problem (this doesn't require any concrete solution or alternatives to have been proposed):
Second, if there's a concrete solution:
The text was updated successfully, but these errors were encountered: