Struct sctp::SctpStream
[−]
[src]
pub struct SctpStream(_);
One-to-one SCTP connected stream which behaves like a TCP stream.
A SctpStream
can be obtained either actively by connecting to a SCTP endpoint with the
connect
constructor, or passively from a SctpListener
which accepts new connections
Methods
impl SctpStream
fn connect<A: ToSocketAddrs>(address: A) -> Result<SctpStream>
Create a new stream by connecting it to a remote endpoint
fn connectx<A: ToSocketAddrs>(addresses: &[A]) -> Result<SctpStream>
Create a new stream by connecting it to a remote endpoint having multiple addresses
fn sendmsg(&self, msg: &[u8], stream: u16) -> Result<usize>
Send bytes on the specified SCTP stream. On success, returns the quantity of bytes read
fn recvmsg(&self, msg: &mut [u8]) -> Result<(usize, u16)>
Read bytes. On success, return a tuple with the quantity of bytes received and the stream they were recived on
fn local_addrs(&self) -> Result<Vec<SocketAddr>>
Return the list of local socket addresses for this stream
fn peer_addrs(&self) -> Result<Vec<SocketAddr>>
Return the list of socket addresses for the peer this stream is connected to
fn shutdown(&self, how: Shutdown) -> Result<()>
Shuts down the read, write, or both halves of this connection
fn set_nodelay(&self, nodelay: bool) -> Result<()>
Set or unset SCTP_NODELAY option
fn has_nodelay(&self) -> Result<bool>
Verify if SCTP_NODELAY option is activated for this socket
fn set_buffer_size(&self, dir: SoDirection, size: usize) -> Result<()>
Set the socket buffer size for the direction specified by dir
.
Linux systems will double the provided size
fn get_buffer_size(&self, dir: SoDirection) -> Result<usize>
Get the socket buffer size for the direction specified by dir
fn set_timeout(&self, dir: SoDirection, timeout: i32) -> Result<()>
Set timeout
in seconds for operation dir
(either receive or send)
fn try_clone(&self) -> Result<SctpStream>
Try to clone the SctpStream. On success, returns a new stream wrapping a new socket handler