Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples on MacOS #170

Closed
arsenron opened this issue Mar 29, 2023 · 5 comments
Closed

Examples on MacOS #170

arsenron opened this issue Mar 29, 2023 · 5 comments

Comments

@arsenron
Copy link

arsenron commented Mar 29, 2023

Hi! I tried to run find_nodes example on MacOS to setup two "nodes" on localhost and it was a little bit unclear how to setup this. On Linux everything worked fine.

The problem is that by default SocketKind is dual stack (ip4 + ip6), so I supposed it should work when I bind to "ip6 socket" , which is by default, and try to send packets to the "ip4 socket". But I failed it to work and was getting an IO error: Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }. The solution is to bind to the ip4 socket, but the error itself is very unclear and maybe it should be addressed to tokio itself, but could we make it more clear in the example documentation for MacOS? Or find some other ways like adding conditional compilation and require to specify SocketKind when #[cfg(target_os = "macos")]?

@divagant-martian
Copy link
Collaborator

divagant-martian commented Mar 31, 2023

Hi, thanks for giving it a try on mac. If you give us the commands you are using to setup the two nodes we can better look into it

@ackintosh
Copy link
Member

ackintosh commented Apr 26, 2023

I confirmed that the error has been reproduced with the commands (on mac):

# Node1
cargo run --example find_nodes -- \
  --enr-ip4 127.0.0.1 \
  --port 9000
# Node2
RUST_LOG=trace cargo run --example find_nodes -- \
  --enr-ip4 127.0.0.1 \
  --port 9001 \
  --remote-peer=(Node1 ENR)

Then the TRACE log below occurs in Node2.

2023-04-26T22:47:59.930963Z TRACE discv5::socket::send: Could not send packet. Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

Also I confirmed that this issue doesn't occur on the two-sockets branch we are working on.

@AgeManning
Copy link
Member

AgeManning commented Apr 27, 2023

Oh nice. So I guess the best solution is to get the two-socket branch down.

@divagant-martian
Copy link
Collaborator

Hey @arsenron could you give this a try again using master? You can run cargo run --example find_nodes -- --help to guide you

@arsenron
Copy link
Author

@divagant-martian Everything now works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants