Trait kipa_lib::socket_server::SocketHandler[][src]

pub trait SocketHandler {
    type SocketType: Read + Write + Send + Sync + 'static;
    fn set_socket_timeout(
        &self,
        socket: &mut Self::SocketType,
        timeout: Option<Duration>
    ) -> Result<()>;
fn get_socket_peer_address(
        &self,
        socket: &Self::SocketType
    ) -> Option<Address>; fn send_data(
        &self,
        data: &[u8],
        socket: &mut Self::SocketType,
        deadline: Option<Instant>
    ) -> Result<()> { ... }
fn receive_data(
        &self,
        socket: &mut Self::SocketType,
        deadline: Option<Instant>
    ) -> Result<Vec<u8>> { ... } }

Type for structs that interface with sockets

Associated Types

The type of the socket to use for sending/receiveing data

Required Methods

Set the timeout of a SocketType

Get the address of the peer connected to the other side of the socket

Provided Methods

Send data down a socket. Handles writing the length of the data

Receive data from a socket. Handles reading the length of the data

Implementors