sirjonasxx / G-Earth

Cross-platform Habbo packet manipulator
MIT License
88 stars 47 forks source link

Lets the OS decide extension server port #154

Closed aromaa closed 1 year ago

aromaa commented 1 year ago

Using port 0 lets the OS to figure out which port is free and bind to it. Then we can just check which port we bound to.

heliocosta-dev commented 1 year ago

Elegant

sirjonasxx commented 1 year ago

The reason I didn't do this is so there is a default port for extensions to use when developing, you probably wouldn't want to reconfigure this in your IDE every time you open G-earth. Now you can just set a default to 9092 and assume it will work if you only have 1 G-Earth instance open (while testing)

aromaa commented 1 year ago

Hmm. Right. We could first bind to 9092 and if that fails then just fallback to using random one.

Alynva commented 1 year ago

Hmm. Right. We could first bind to 9092 and if that fails then just fallback to using random one.

What's the point of having a random port every time? Hide that you're using G-Earth?

Alynva commented 1 year ago

@Alynva I think it means that if a port is selected programmatically, there is a risk that it is busy

        port = PORT_ONSET; 
         while (!available(port)) 
             port++;
dorving commented 1 year ago

I vote for keeping the incremental port as the default behavior. One thing I would not be opposed to is to allow for an optional environment variable to be set that specifies the port onset, if not specified, the onset will remain 9092.