ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
785 stars 105 forks source link

tcpstream can not use try_clone method #141

Closed xiaoheng14 closed 1 year ago

xiaoheng14 commented 1 year ago

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)

ivmarkov commented 1 year ago

The error message says: "as expected".