pub fn new<A: ToSocketAddrs>(
        socket_addrs: A,
        timeout: Option<Duration>,
    ) -> Result<Self, Error> {
        let stream = match timeout {
            Some(timeout) => {
                let stream = connect_with_total_timeout(socket_addrs, timeout)?;
                stream.set_read_timeout(Some(timeout))?;
                stream.set_write_timeout(Some(timeout))?;
                stream
            }
            None => TcpStream::connect(socket_addrs)?,
        };

        Ok(stream.into())
    }
/// Creates a new plaintext client and tries to connect to `socket_addr`.
Creates a new plaintext client and tries to connect to `socket_addr`.
Creates a new plaintext client and tries to connect to ` socket_addr ` .
pub fn new<A: ToSocketAddrs>(
        socket_addrs: A,
        timeout: Option<Duration>,
    ) -> Result<Self, Error> {
        let stream = match timeout {
            Some(timeout) => {
                let stream = connect_with_total_timeout(socket_addrs, timeout)?;
                stream.set_read_timeout(Some(timeout))?;
                stream.set_write_timeout(Some(timeout))?;
                stream
            }
            None => TcpStream::connect(socket_addrs)?,
        };
        Ok(stream.into())
    }
pub fn new < A : ToSocketAddrs > ( socket_addrs : A , timeout : Option < Duration > , ) -> Result < Self , Error > { let stream = match timeout { Some ( timeout ) => { let stream = connect_with_total_timeout ( socket_addrs , timeout ) ? ; stream . set_read_timeout ( Some ( timeout ) ) ? ; stream . set_write_timeout ( Some ( timeout ) ) ? ; stream } None => TcpStream :: connect ( socket_addrs ) ? , } ; Ok ( stream . into ( ) ) }
Creates a new plaintext client and tries to connect to `socket_addr`.
Creates a new plaintext client and tries to connect to ` socket_addr ` .
socket_addrs
A
timeout
Option<Duration>
socket_addrs
A
timeout
Option<Duration>