Struct tokio_uds::UnixDatagram
[−]
[src]
pub struct UnixDatagram { // some fields omitted }
An I/O object representing a Unix datagram socket.
Methods
impl UnixDatagram
[src]
fn bind<P>(path: P, handle: &Handle) -> Result<UnixDatagram> where P: AsRef<Path>
Creates a new UnixDatagram
bound to the specified path.
fn pair(handle: &Handle) -> Result<(UnixDatagram, UnixDatagram)>
Creates an unnamed pair of connected sockets.
This function will create a pair of interconnected unix sockets for communicating back and forth between one another. Each socket will be associated with the event loop whose handle is also provided.
fn connect<P: AsRef<Path>>(&self, path: P) -> Result<()>
Connects the socket to the specified address.
The send
method may be used to send data to the specified address.
recv
and recv_from
will only receive data from that address.
fn poll_read(&self) -> Async<()>
Test whether this socket is ready to be read or not.
fn poll_write(&self) -> Async<()>
Test whether this socket is writey to be written to or not.
fn local_addr(&self) -> Result<SocketAddr>
Returns the local address that this socket is bound to.
fn peer_addr(&self) -> Result<SocketAddr>
Returns the address of this socket's peer.
The connect
method will connect the socket to a peer.
fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Receives data from the socket.
On success, returns the number of bytes read and the address from whence the data came.
fn recv(&self, buf: &mut [u8]) -> Result<usize>
Receives data from the socket.
On success, returns the number of bytes read.
fn send_to<P>(&self, buf: &[u8], path: P) -> Result<usize> where P: AsRef<Path>
Sends data on the socket to the specified address.
On success, returns the number of bytes written.
fn send(&self, buf: &[u8]) -> Result<usize>
Sends data on the socket to the socket's peer.
The peer address may be set by the connect
method, and this method
will return an error if the socket has not already been connected.
On success, returns the number of bytes written.
fn take_error(&self) -> Result<Option<Error>>
Returns the value of the SO_ERROR
option.
fn shutdown(&self, how: Shutdown) -> Result<()>
Shut down the read, write, or both halves of this connection.
This function will cause all pending and future I/O calls on the
specified portions to immediately return with an appropriate value
(see the documentation of Shutdown
).