Struct tokio_utun::UtunStream
[−]
[src]
pub struct UtunStream { /* fields omitted */ }
The primary class for this crate, a stream of tunneled traffic.
Methods
impl UtunStream
[src]
fn connect(name: &str, handle: &Handle) -> Result<UtunStream>
[src]
fn framed<C: UtunCodec>(self, codec: C) -> UtunFramed<C>
[src]
Provides a Stream
and Sink
interface for reading and writing to this
UdpSocket
object, using the provided UdpCodec
to read and write the
raw data.
Raw UDP sockets work with datagrams, but higher-level code usually
wants to batch these into meaningful chunks, called "frames". This
method layers framing on top of this socket by using the UdpCodec
trait to handle encoding and decoding of messages frames. Note that
the incoming and outgoing frame types may be distinct.
This function returns a single object that is both Stream
and
Sink
; grouping this into a single object is often useful for layering
things which require both read and write access to the underlying
object.
If you want to work more directly with the streams and sink, consider
calling split
on the UdpFramed
returned by this method, which will
break them into separate objects, allowing them to interact more
easily.
fn send(&self, buf: &[u8]) -> Result<usize>
[src]
Sends data on the socket to the address previously bound via connect(). On success, returns the number of bytes written.
fn recv(&self, buf: &mut [u8]) -> Result<usize>
[src]
Receives data from the socket previously bound with connect(). On success, returns the number of bytes read.
fn poll_read(&self) -> Async<()>
[src]
Test whether this socket is ready to be read or not.
If the socket is not readable then the current task is scheduled to
get a notification when the socket does become readable. That is, this
is only suitable for calling in a Future::poll
method and will
automatically handle ensuring a retry once the socket is readable again.
fn poll_write(&self) -> Async<()>
[src]
Test whether this socket is ready to be written to or not.
If the socket is not writable then the current task is scheduled to
get a notification when the socket does become writable. That is, this
is only suitable for calling in a Future::poll
method and will
automatically handle ensuring a retry once the socket is writable again.