GitXplorerGitXplorer
d

tokio-seqpacket-rs

public
15 stars
13 forks
2 issues

Commits

List of commits on branch main.
Unverified
00bb69c667ecd15a67e2704b35c61d00cf525f98

Update changelog for Illumos/Solaris fix.

dde-vri-es committed a year ago
Verified
4ef900ff630ed68f7cb5250c7407f6dea4d99de3

Merge pull request #21 from jclulow/illumos

dde-vri-es committed a year ago
Unverified
fc9f076dbdb7902194988bbbbd0a580a62723e97

fix illumos build after f224d37e0737d

jjclulow committed a year ago
Unverified
ed9aabfa28b831c5e404847c7bdaacab63e9c2ae

Ensure proper alignment of control message buffer in writer.

dde-vri-es committed a year ago
Unverified
a76f11ceab84917bd2aef6737ac66b47b7462825

Bump version to 0.7.0.

dde-vri-es committed 2 years ago
Unverified
123311a3b35fb1d9950b08585603d6999754b37e

Fix `OwnedFileDescriptors` iteration.

dde-vri-es committed 2 years ago

README

The README file for this repository.

Docs.rs Tests

tokio-seqpacket

Unix seqpacket sockets for tokio.

Seqpacket sockets combine a number of useful properties:

  • They are connection oriented.
  • They guarantee in-order message delivery.
  • They provide datagrams with well-defined semantics for passing along file descriptors.

These properties make seqpacket sockets very well suited for local servers that need to pass file-descriptors around with their clients.

You can create a UnixSeqpacketListener to start accepting connections, or create a UnixSeqpacket to connect to a listening socket. You can also create a pair of connected sockets with UnixSeqpacket::pair().

Passing file descriptors and other ancillary data.

You can use send_vectored_with_ancillary and recv_vectored_with_ancillary to send and receive ancillary data. This can be used to pass file descriptors and unix credentials over sockets.

&self versus &mut self

Seqpacket sockets have well-defined semantics when sending or receiving on the same socket from different threads. Although the order is not guaranteed in that scenario, each datagram will be delivered intact. Since tokio 0.3, it is also possible for multiple tasks to await the same file descriptor. As such, all I/O functions now take &self instead of &mut self, and the split() API has been deprecated.

Example

use tokio_seqpacket::UnixSeqpacket;

let mut socket = UnixSeqpacket::connect("/run/foo.sock").await?;
socket.send(b"Hello!").await?;

let mut buffer = [0u8; 128];
let len = socket.recv(&mut buffer).await?;
println!("{}", String::from_utf8_lossy(&buffer[..len]));