ivmarkov/rust-esp32-std-demo

tcpstream can not use try_clone method

xiaoheng14 opened this issue · 1 comments

fn test_tcp() -> Result<()> {
info!("About to open a TCP connection to 1.1.1.1 port 80");

let mut stream = TcpStream::connect("one.one.one.one:80")?;

let err = stream.try_clone();
if let Err(err) = err {
    info!(
        "Duplication of file descriptors does not work (yet) on the ESP-IDF, as expected: {}",
        err
    );
}

stream.write_all("GET / HTTP/1.0\n\n".as_bytes())?;

let mut result = Vec::new();

stream.read_to_end(&mut result)?;

info!(
    "1.1.1.1 returned:\n=================\n{}\n=================\nSince it returned something, all is OK",
    std::str::from_utf8(&result)?);

Ok(())

}

here is the log output
rust_esp32_std_demo: Duplication of file descriptors does not work (yet) on the ESP-IDF, as expected: Function not implemented (os error 88)

The error message says: "as expected".