Accessing assigned port when port 0 is used #430
Closed
zelakus
started this conversation in
Feature Request
Replies: 3 comments 3 replies
-
Am I understanding that you are listening on port 0 which is automatically assigning a port within LiteNetLib, but you cannot fetch that port at runtime as it only returns 0? If so, I could make the transport try to fetch from the active port if started otherwise provide the configured port. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Try this please |
Beta Was this translation helpful? Give feedback.
1 reply
-
This was added. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As of FishNet Pro 3.10.4, using Tugboat transport there is no way to access the assigned port when using 0 to make use of any available port. This is a much needed feature as I am launching as many server instances as necessary on a dedicated server and would like to avoid any kind of clashing or race conditions while picking the port across processes. And while it works, FishNet isn't providing the assigned port.
The way server was started is as such:
Behavior was as expected, it used an available port and started successfully however trying to get the port with the following did not work out:
Result was
0.0.0.0:0
giving me the port I've provided earlier, not what the server's socket is bind to.As LiteNetLib already provides the said port with the LocalPort property on it's NetManager, this is also accessible in the
FishNet.Transporting.Tugboat.Server.ServerSocket::ThreadedSocket
method. Perhaps_server.LocalPort
can be set as Tugboat's_port
upon success while enqueueing theLocalConnectionState.Started
.This would make the underlying feature actually usable as the assigned port would be known.
Note: This port 0 feature isn't something special to LiteNetLib, it's just what I have as my transport currently.
Beta Was this translation helpful? Give feedback.
All reactions