websockets-rs / websockets-rs/rust-websocket
localhost does not resolve
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
I tried to open an async connection to a server running locally at ws://localhost:4000 and received the following error:
IoError(Error { repr: Os { code: 61, message: "Connection refused" } })
However, the following work:
- opening an async websocket connection to
ws://127.0.0.1:4000. So my code connects once DNS is resolved. - opening an async websocket connection to
ws://echo.websocket.org. So websocket DNS resolution does work in some cases. - opening a synchronous websocket connection to
ws://localhost:4000. So local DNS resolution works but only for synchronous connections. - opening an async HTTP connection to
http://localhost:4000with Hyper 0.11. Does Hyper 0.11 use a different Tokio primitive to resolve DNS?
I'm not exactly sure what's going on. It's not a big deal - I'm manually resolving localhost to 127.0.0.1 - but I'm kind of curious.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the async websocket connection to ws://localhost:4000 and compare it with ws://127.0.0.1:4000, the synchronous websocket path, and the Hyper 0.11 HTTP path. Trace the async DNS resolution entry point and determine why localhost differs; done means async websocket connections resolve localhost successfully without manual substitution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100