-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow server to bind on zero port number #1185
Comments
If you are building a multi-users management system, you should allocate ports in the application level. First of all, the port for a specific user should be fixed all the time, because the Secondly, the port should be allocated globally, because there shouldn't have only 1 "machine" or "instance" of server in your system, so if users were transferred from one instance to another, the port should be unique globally. If the server is your personal private server, then you could always set a fixed "free" port every time when the Summary: Allow binding to port |
That might not be possible. For instance, with userbase about ~200k you cannot pre-allocate a unique port for each user. That's why the “on-demand” approach fits better here, when you assign port only when the user really needs it. |
Well, since you have ~200k users, you must have a cluster of machines. For each users, you must provide a unique tuple In other words, the unique key of Allow binding to port |
That's a suitable approach in general, when binding is static (i.e., assign once and forget.) In my use case, users can migrate from one server to another frequently (each ~5-10min). |
Nope. The binding is just a record about which servers and ports are occupied, you can change whatever you want dynamically. In other words: you can always know which ports are "free" in your system. |
Build server with ServerBuilder, build() will create both TCP & UDP servers' listener, which will allow users to retrieve the actual listening address of the listeners. Basic feature support of #1185 .
I just tried to run |
The idea was to bind TCP port on 0, then get the actual port number, and try to bind UDP on it. Anyway, that sounds great. Thank you for your work! |
The current implementation doesn't work like that. Both TCP & UDP will try to
I still prefer the second solution, which is much more simplier. |
Already provided Builder interfaces for retriving bound socket addresses for all service instances. |
Currently, you must set port number each time either via config or via API.
Every so often that port could be busy, sometimes not, which adds additional cost to error handling and synchronizations. That becomes really complicated with
ssmanager
and when you add-remove users fast enough.The proposal is that:
add_dynamic
(so as not to break any backward compatibility)OK:{"port": 42}
Regarding UDP, I see two options here:
protocol
(tcp
,tcpudp
, etc)Thoughts?
The text was updated successfully, but these errors were encountered: