Skip to main content

tcp_connect

Function tcp_connect 

pub async fn tcp_connect<Connector>(
    extensions: &Extensions,
    address: HostWithPort,
    connector: &Connector,
) -> Result<(TcpStream, SocketAddr), Box<dyn Error + Sync + Send>>
where Connector: TcpStreamConnector, <Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>> + Send + 'static,
Available on crate features std and tcp only.
Expand description

Establish a TcpStream connection for the given HostWithPort.

The host must be an IP address. Domain-name resolution belongs in rama-dns connector middleware.

IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) are canonicalized to the embedded IPv4 address, as they identify IPv4 wire traffic.