pub trait VirtualConnectedSocket:
VirtualSocket
+ Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn set_linger(&mut self, linger: Option<Duration>) -> Result<()>;
fn linger(&self) -> Result<Option<Duration>>;
fn send(&mut self, data: Bytes) -> Result<usize>;
fn flush(&mut self) -> Result<()>;
fn recv(&mut self) -> Result<SocketReceive>;
fn peek(&mut self) -> Result<SocketReceive>;
}
Expand description
Connected sockets have a persistent connection to a remote peer
Required Methods§
Sourcefn set_linger(&mut self, linger: Option<Duration>) -> Result<()>
fn set_linger(&mut self, linger: Option<Duration>) -> Result<()>
Determines how long the socket will remain in a TIME_WAIT after it disconnects (only the one that initiates the close will be in a TIME_WAIT state thus the clients should always do this rather than the server)
Sourcefn linger(&self) -> Result<Option<Duration>>
fn linger(&self) -> Result<Option<Duration>>
Returns how long the socket will remain in a TIME_WAIT after it disconnects
Sourcefn send(&mut self, data: Bytes) -> Result<usize>
fn send(&mut self, data: Bytes) -> Result<usize>
Sends out a datagram or stream of bytes on this socket
Sourcefn recv(&mut self) -> Result<SocketReceive>
fn recv(&mut self) -> Result<SocketReceive>
Recv a packet from the socket
Sourcefn peek(&mut self) -> Result<SocketReceive>
fn peek(&mut self) -> Result<SocketReceive>
Peeks for a packet from the socket