https://github.com/paritytech/parity-tokio-ipc
Parity tokio-ipc
https://github.com/paritytech/parity-tokio-ipc
inter-process-communication named-pipes unix-socket
Last synced: 3 months ago
JSON representation
Parity tokio-ipc
- Host: GitHub
- URL: https://github.com/paritytech/parity-tokio-ipc
- Owner: paritytech
- License: apache-2.0
- Created: 2017-03-14T15:54:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T14:05:46.000Z (over 1 year ago)
- Last Synced: 2025-03-28T06:11:10.246Z (3 months ago)
- Topics: inter-process-communication, named-pipes, unix-socket
- Language: Rust
- Homepage:
- Size: 117 KB
- Stars: 76
- Watchers: 8
- Forks: 50
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# parity-tokio-ipc
[](https://github.com/paritytech/parity-tokio-ipc/actions/workflows/ci.yml)
[](https://docs.rs/parity-tokio-ipc)This crate abstracts interprocess transport for UNIX/Windows.
It utilizes unix sockets on UNIX (via `tokio::net::UnixStream`) and named pipes on windows (via `tokio::net::windows::named_pipe` module).
Endpoint is transport-agnostic interface for incoming connections:
```rust
use parity_tokio_ipc::Endpoint;
use futures::stream::StreamExt;// For testing purposes only - instead, use a path to an actual socket or a pipe
let addr = parity_tokio_ipc::dummy_endpoint();let server = async move {
Endpoint::new(addr)
.incoming()
.expect("Couldn't set up server")
.for_each(|conn| async {
match conn {
Ok(stream) => println!("Got connection!"),
Err(e) => eprintln!("Error when receiving connection: {:?}", e),
}
});
};let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
rt.block_on(server);
```# License
`parity-tokio-ipc` is primarily distributed under the terms of both the MIT
license and the Apache License (Version 2.0), with portions covered by various
BSD-like licenses.See LICENSE-APACHE, and LICENSE-MIT for details.