Network: add PORTS_EPHEMERAL constant
authorTJ <hacker@iam.tj>
Mon, 4 May 2015 15:21:35 +0000 (16:21 +0100)
committerTJ <hacker@iam.tj>
Mon, 4 May 2015 15:21:35 +0000 (16:21 +0100)
This, rather than a plain 0, adds semmantic sugar to make it obvious when constructing
a socket and expecting to be given an ephemeral port by the operating system.

src/uk/ac/ntu/n0521366/wsyd/libs/net/Network.java

index 6cc4e12..0f02897 100644 (file)
@@ -37,6 +37,7 @@ public class Network {
     public static final int PORTS_MULTICAST_DISCOVERY = 50003;
     public static final int PORTS_CLIENT_CONTROL_FIRST = 50010;
     public static final int PORTS_CLIENT_CHAT_FIRST = 51000;
+    public static final int PORTS_EPHEMERAL = 0;
     
     /**
      * Special IPv4 'wildcard' address asking java.net.ServerSocket#bind to bind to all interfaces.