Function tcp

Source
pub fn tcp<R: Into<Addr>>(remote_addr: R) -> Builder
Available on crate features blocking or tokio only.
Expand description

Shortcut method to create a TCP connection

ยงExamples

Supports both blocking and tokio. Swap about connect_async for connect and remove the .await annotations.

let conn = insim::tcp("127.0.0.1:29999").connect_async().await?;
loop {
    let packet = conn.read().await?;
    println!("{:?}", packet);
}