[][src]Struct aurpc::RpcSocket

pub struct RpcSocket { /* fields omitted */ }

A RPC socket.

After creating a RpcSocket by binding it to a socket address, RPCs can be sent to and received from any other socket address.


impl RpcSocket[src]

pub async fn bind<A: ToSocketAddrs>(addrs: A) -> Result<Self>[src]

Creates a RPC socket from the given address.

Binding with a port number of 0 will request that the OS assigns a port to this socket. THe port allocated can be queried via the local_addr method.

pub fn local_addr(&self) -> Result<SocketAddr>[src]

Returns the local address that this listener is bound to.

This can be useful, for example, when binding to port 0 to figure out which port was actually bound.

pub async fn send_to<'a, '_, '_, A: ToSocketAddrs>(
    &'_ self,
    buf: &'_ [u8],
    rsp_buf: &'a mut [u8],
    addrs: A
) -> Result<(usize, ResponseFuture<'a>)>

Sends an RPC on the socket to the given address.

On success, returns the number of bytes written to and read from the socket.

pub async fn recv_from<'_, '_>(
    &'_ self,
    buf: &'_ mut [u8]
) -> Result<(usize, RpcResponder)>

Receives RPC from the socket.

On success, returns the number of bytes read and the origin.

pub fn ttl(&self) -> Result<u32>[src]

Gets the value of the IP_TTL option for this socket.

For more information about this option, see set_ttl.

pub fn set_ttl(&self, ttl: u32) -> Result<()>[src]

Sets the value for the IP_TTL option on this socket.

This value sets the time-to-live field that is used in every packet sent from this socket.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.