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.
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)
fn test_tcp() -> Result<()> { info!("About to open a TCP connection to 1.1.1.1 port 80");
}
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)