GitXplorerGitXplorer
d

tokio-seqpacket-rs

public
15 stars
13 forks
2 issues

Commits

List of commits on branch main.
Unverified
c177d8d7246cb62c8f49deb0e959d7f395e2fc51

Add tests for abstract namespace sockets on Linux and Android.

dde-vri-es committed 2 months ago
Verified
69987af1f22443fe40a320434a6977cb7a93ad64

Do not add trailing zero byte for abstract paths.

vvi committed 2 months ago
Verified
90a13657bfae349b9f0529fbfbd073748fd4a6d1

Merge pull request #22 from asomers/patch-1

dde-vri-es committed a year ago
Verified
f73bffa510bfe21a381b454c021baf4502b3a638

Update FreeBSD CI image

aasomers committed a year ago
Unverified
2047e0d8004e08f44d4aa87ebee0a590c1269e93

Bump version to 0.7.1.

dde-vri-es committed a year ago
Unverified
9f97061dcd594ba885a3b00e9d4eedc58660039b

Remove unneeded `mut`.

dde-vri-es committed a year 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]));