Open ChocolateLoverRaj opened 8 months ago
I'm looking at implementing this, but I have some questions.
There's a few ways ports can be selected.
9000
for example, in my opinion this should fail if port 9000
is already taken.8080
is taken be default, in my opinion this is where dioxus could look into other open ports.0
, this means the OS allocates a free open port.Right now what happens is the browser (if the option is chosen) is opened on the port, then the server begins. This change would have to start the server first, then open the browser on the port chosen (especially in the case of port 0
).
Improving the error message to suggest that --port
can be used to start on a different port if needed would be nice.
We now have a better error:
0: Failed to bind server to: 127.0.0.1:8080, is there another devserver running?
To run multiple devservers, use the --port flag to specify a different port
1: Address already in use (os error 48)
It's a better error than before, but it doesn't change the motivation behind this issue.
Specific Demand
If there's already another http server using port 8080, running
dx serve
(on the Web app) fails:Implement Suggestion
If
8080
isn't available, try using8081
. If that's not available, use8082
, etc. I'm pretty sure Webpack does this and it's convenient.