pub struct TcpConnection {
pub local: SocketAddr,
pub remote: SocketAddr,
pub state: TcpState,
pub seq_num: u32,
pub ack_num: u32,
pub window_size: u16,
}Expand description
TCP connection
Fields§
§local: SocketAddr§remote: SocketAddr§state: TcpState§seq_num: u32§ack_num: u32§window_size: u16Implementations§
Source§impl TcpConnection
impl TcpConnection
pub fn new(local: SocketAddr, remote: SocketAddr) -> Self
Sourcepub fn connect(&mut self) -> Result<(), KernelError>
pub fn connect(&mut self) -> Result<(), KernelError>
Initiate connection (active open) – sends SYN via IP layer.
Sourcepub fn listen(&mut self) -> Result<(), KernelError>
pub fn listen(&mut self) -> Result<(), KernelError>
Listen for connections (passive open)
Sourcepub fn send(&mut self, data: &[u8]) -> Result<usize, KernelError>
pub fn send(&mut self, data: &[u8]) -> Result<usize, KernelError>
Send data by segmenting into MSS-sized chunks.
Sourcepub fn recv(&mut self, _buffer: &mut [u8]) -> Result<usize, KernelError>
pub fn recv(&mut self, _buffer: &mut [u8]) -> Result<usize, KernelError>
Receive data from the connection’s receive buffer.
Sourcepub fn close(&mut self) -> Result<(), KernelError>
pub fn close(&mut self) -> Result<(), KernelError>
Close connection by sending FIN.
Trait Implementations§
Source§impl Clone for TcpConnection
impl Clone for TcpConnection
Source§fn clone(&self) -> TcpConnection
fn clone(&self) -> TcpConnection
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TcpConnection
impl RefUnwindSafe for TcpConnection
impl Send for TcpConnection
impl Sync for TcpConnection
impl Unpin for TcpConnection
impl UnwindSafe for TcpConnection
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)