Skip to content

Automatically use a different port if port 8080 is in use #1945

@ChocolateLoverRaj

Description

@ChocolateLoverRaj

Specific Demand

If there's already another http server using port 8080, running dx serve (on the Web app) fails:

Dioxus @ v0.4.1 [20:24:14] 

        > Local : http://localhost:8080/
        > Network : http://192.168.1.3:8080/
        > HTTPS : Disabled

        > Profile : Debug
        > Hot Reload : Normal
        > Index Template : Default
        > URL Rewrite [index_on_404] : True

        > Build Time Use : 63658 millis

[INFO] A perfect compilation!

thread 'main' panicked at /var/home/rajas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.28/src/server/server.rs:81:13:
error binding to 0.0.0.0:8080: error creating server listener: Address already in use (os error 98)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Implement Suggestion

If 8080 isn't available, try using 8081. If that's not available, use 8082, etc. I'm pretty sure Webpack does this and it's convenient.

Metadata

Metadata

Assignees

Labels

cliRelated to the dioxus-cli programenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions