We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98f4a3c commit a9e4754Copy full SHA for a9e4754
src/org/java_websocket/server/WebSocketServer.java
@@ -212,7 +212,11 @@ public InetSocketAddress getAddress() {
212
* @return The port number.
213
*/
214
public int getPort() {
215
- return getAddress().getPort();
+ int port = getAddress().getPort();
216
+ if( port == 0 && server != null ) {
217
+ port = server.socket().getLocalPort();
218
+ }
219
+ return port;
220
}
221
222
public List<Draft> getDraft() {
0 commit comments