embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.55k stars 770 forks source link

example: std net `ConnectionReset` on Ubuntu 22.04 #1853

Open LimpidCrypto opened 1 year ago

LimpidCrypto commented 1 year ago

I'm currently trying to implement embedded-io-async for embedded-async to use the websocket with embassy-net.

I have followed the instructions in the README file to set up tap0:

tap0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.69.100  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::f884:56ff:fe3b:b1e1  prefixlen 64  scopeid 0x20<link>
        ether fa:84:56:3b:b1:e1  txqueuelen 1000  (Ethernet)
        RX packets 273  bytes 13622 (13.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 81  bytes 7858 (7.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Then I had netcat listen to port 8000 using nc -l 8000. I just copied your current std net example and ran it like so: cargo run --example client_async_embedded_io_async --features "embedded-io-async" -- --static-ip

I'm getting a ConnectionReset error. Are there common sources for the error?

[2023-09-01T19:06:54.626511374Z INFO  client_async_embedded_io_async] Opts { tap: "tap0", static_ip: true }
[2023-09-01T19:06:54.626801340Z INFO  client_async_embedded_io_async] Config { ipv4: Static(StaticConfigV4 { address: Cidr { address: Address([192, 168, 69, 2]), prefix_len: 24 }, gateway: Some(Address([192, 168, 69, 1])), dns_servers: [] }), ipv6: None }
[2023-09-01T19:06:54.626862835Z DEBUG embassy_net] IPv4: UP
[2023-09-01T19:06:54.626870159Z DEBUG embassy_net]    IP address:      Cidr { address: Address([192, 168, 69, 2]), prefix_len: 24 }
[2023-09-01T19:06:54.626881751Z DEBUG embassy_net]    Default gateway: Some(Address([192, 168, 69, 1]))
[2023-09-01T19:06:54.626892411Z INFO  embassy_net] IPv6: DOWN
[2023-09-01T19:06:54.626913320Z INFO  client_async_embedded_io_async] connecting to (Address([192, 168, 69, 100]), 8000)...
[2023-09-01T19:06:54.626988382Z INFO  embassy_net] link_up = true
[2023-09-01T19:07:04.627134220Z WARN  client_async_embedded_io_async] connect error: ConnectionReset

Please let me know if you need more information.

Dirbaio commented 1 year ago

are you using GNU netcat or BSD netcat? nc -l 8000 works for BSD netcat, for GNU the flags are different (not sure which).