std::os::unix::net
本页内容
- Structs
- Implementations
impl ReadHalf1
API 参考只有英文版,由标准库源代码中的英文文档注释生成。
Unix domain sockets. Like
the TCP ones: non-blocking underneath, set_*_timeout bounds the
blocking calls, *_async suspend the task. A listener's accept
gives the peer's bound path (none: unnamed). A stream connect
waits only for a full backlog; connect_async waits on a blocking
thread.
Structs
UnixStreamSource
pub struct UnixStreamA Unix stream socket. It has one owner (let b = a moves it); close
it with try s.close() or using.
Connect to the socket at
path.connectthat suspends the task until the connection is made.Two connected ends (
socketpair).bufwith fdfdalongside (SCM_RIGHTS): the bytes sent.
Sourcepub async fn send_with_fd_async<B: AsBytes>(§ref self, buf: B, fd: RawFd) throws (IoError) -> usize send_with_fdthat suspends the task while the socket is full.One read into
bufand the fd passed with it, if any (the caller owns it; it is close-on-exec).
Sourcepub async fn recv_with_fd_async(§ref self, buf: SliceMut<u8>) throws (IoError) -> (usize, RawFd | none) recv_with_fdthat suspends the task until data arrives.The peer's path;
nonewhen unnamed.The path this socket is bound to;
nonewhen unnamed.Shut down reading, writing or both.
As
shutdown, which never waits.Limit blocking reads to
dur, thenTimedOut;nonewaits forever.Limit blocking writes to
dur, thenTimedOut;nonewaits forever.Make blocking calls throw
WouldBlockinstead of waiting.A second handle to the same socket.
Split into a read half and a write half, as
TcpStream::split.Close now, throwing the OS's error.
Trait implementations 11
UnixListenerSource
pub struct UnixListenerA listening Unix stream socket bound to a path.
Bind
path(it must not exist yet) and listen (backlog 128).
Sourcepub fn accept(§self) throws (IoError) -> (UnixStream, Path | none) The next connection and the path its peer is bound to (
none: unnamed, the usual case), blocking until one arrives.
Sourcepub async fn accept_async(§ref self) throws (IoError) -> (UnixStream, Path | none) acceptthat suspends the task until a connection arrives.The path this socket is bound to;
nonewhen unnamed.Make
acceptthrowWouldBlockinstead of waiting.A second handle to the same socket.
Close now, throwing the OS's error.
UnixDatagramSource
pub struct UnixDatagramA Unix datagram socket.
A datagram socket bound to
path.A datagram socket connected to
path(unbound itself).As
connect, which never waits for a datagram socket.Two connected datagram ends (
socketpair).Send the datagram
bufto the connected peer; bytes sent.sendthat suspends the task while the socket is full.The next datagram into
buf[0..n](truncated tobuf.len()).recvthat suspends the task until a datagram arrives.sendwithfdpassed alongside (SCM_RIGHTS).
Sourcepub async fn send_with_fd_async<B: AsBytes>(§ref self, buf: B, fd: RawFd) throws (IoError) -> usize send_with_fdthat suspends the task while the socket is full.recvwith the descriptor passed alongside, if any.
Sourcepub async fn recv_with_fd_async(§ref self, buf: SliceMut<u8>) throws (IoError) -> (usize, RawFd | none) recv_with_fdthat suspends the task until a datagram arrives.The path this socket is bound to;
nonewhen unnamed.Limit blocking reads to
dur, thenTimedOut;nonewaits forever.Limit blocking writes to
dur, thenTimedOut;nonewaits forever.Make blocking calls throw
WouldBlockinstead of waiting.Close now, throwing the OS's error.
Implementations
impl ReadHalf
Sourcepub fn unsplit(§self, w: WriteHalf<UnixStream>) -> UnixStream The stream again, from this half and the
WriteHalfthatsplitgave with it. Panics on a write half of another stream.