Compare commits

..

1 Commits

Author SHA1 Message Date
602b8915e4 Ethernet and smoltcp/embassy-net support
Some checks failed
ci / Check build (push) Has been cancelled
ci / Check formatting (push) Has been cancelled
ci / Check Documentation Build (push) Has been cancelled
ci / Clippy (push) Has been cancelled
ci / Check build (pull_request) Has been cancelled
ci / Check formatting (pull_request) Has been cancelled
ci / Check Documentation Build (pull_request) Has been cancelled
ci / Clippy (pull_request) Has been cancelled
2025-07-16 15:40:36 +02:00

View File

@@ -7,7 +7,20 @@
//! Alternatively, you can also set a static IPv4 configuration via the `STATIC_IPV4_CONFIG`
//! constant and by setting `USE_DHCP` to `false`.
//!
//! It also exposes simple UDP and TCP echo servers.
//! It also exposes simple UDP and TCP echo servers. You can use the following sample commands
//! to send UDP or TCP data to the Zedboard using the Unix `netcat` application:
//!
//! ## UDP
//!
//! ```sh
//! echo "Hello Zedboard" | nc -uN <ip-address> 8000
//! ```
//!
//! ## TCP
//!
//! ```sh
//! echo "Hello Zedboard" | nc -N <ip-address> 8000
//! ```
#![no_std]
#![no_main]
@@ -118,7 +131,7 @@ async fn udp_task(mut udp: UdpSocket<'static>) -> ! {
loop {
match udp.recv_from(&mut rx_buf).await {
Ok((data, meta)) => {
log::info!("UDP: rx {data} bytes from {meta:?}");
log::info!("udp rx {data} bytes from {meta:?}");
match udp.send_to(&rx_buf[0..data], meta).await {
Ok(_) => (),
Err(e) => {
@@ -152,6 +165,7 @@ async fn tcp_task(mut tcp: TcpSocket<'static>) -> ! {
tcp.close();
}
Ok(read_bytes) => {
log::info!("tcp rx {read_bytes} bytes");
if tcp.may_send() {
match tcp.write_all(&rx_buf[0..read_bytes]).await {
Ok(_) => continue,