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

Running on 127.0.0.1 breaks Windows support #48

Open
connorcarpenter opened this issue Apr 21, 2022 · 4 comments
Open

Running on 127.0.0.1 breaks Windows support #48

connorcarpenter opened this issue Apr 21, 2022 · 4 comments
Labels
bug needs fixing naia socket pertaining to naia_socket crates

Comments

@connorcarpenter
Copy link
Member

As per @smokku in https://github.com/naia-rs/naia-socket/issues/24

Change bd5365c breaks Windows support.

    Finished dev [unoptimized + debuginfo] target(s) in 0.84s
     Running `D:\devel\naia-socket\target\debug\naia-client-socket-miniquad-example.exe`
Naia Client Socket Example Started
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 10049, kind: AddrNotAvailable, message: "Żądany adres jest nieprawidłowy w tym kontekście." }', demo\client\miniquad\src\app.rs:39:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `D:\devel\naia-socket\target\debug\naia-client-socket-miniquad-example.exe` (exit code: 101)
@connorcarpenter
Copy link
Member Author

as per @Meshiest in https://github.com/naia-rs/naia-socket/issues/24

I'm running into this.

replacing client_ip_address with "0.0.0.0" in the udp socket bind fixes it for me
https://github.com/naia-rs/naia-socket/blob/master/client/src/impls/native/socket.rs#L41

@connorcarpenter connorcarpenter changed the title naia_socket: Running on 127.0.0.1 breaks Windows support Running on 127.0.0.1 breaks Windows support Apr 21, 2022
@connorcarpenter connorcarpenter added naia socket pertaining to naia_socket crates bug needs fixing labels Apr 21, 2022
@ineentho
Copy link

I can confirm that the same fix works for me on windows.

I'd be interested in contributing a fix, if could give me advice on the best path forward please? The different options I see:

  • Add a new option client_bind_address: Option to SocketConfig, which would be used instead of the current automatic detection if defined.
  • Add a special case to the automatic detection: if addr == 127.0.0.1 then addr = 0.0.0.0
  • The above special case, but only for windows

@SonicZentropy
Copy link

Also running into this and fix also works for me. I'd also be happy to help fix the problem rather than maintaining my own fork

@SonicZentropy
Copy link

Adding in a bit more info, my fix originally used the auto-detection option, but that one can break as well. Sometimes naia returns my LAN IP (192.168.1.100) rather than localhost (127.0.0.1), in which case the auto-detect obviously fails. I'm now brute forcing it to 0.0.0.0 when cfg(target_os = "windows")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs fixing naia socket pertaining to naia_socket crates
Projects
None yet
Development

No branches or pull requests

3 participants