The best type to represent a TCP port in Java/Scala is char/Char. Assigning any integer literal to it that is not a valid port number is a compilation error. The port number can be correctly determined just by casting to int/Int.
-
-
Java lacks a ushort?
-
Java doesn't have any unsigned "integer" types, byte, short, int and long are all you get, and they are all signed. The only exception is char, if you consider it an integer, which is unsigned.
- Show replies
New conversation -
-
-
Yes, in tests, all the time. I always use ephemeral ports when testing, since there's no danger of port conflict, and all ephemeral ports are greater than 32767. Of course, I never use an ephemeral port literal in tests, you use port zero to request an ephemeral port.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Yes, all the time.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
yes of course. if i run out of 80, 8080, 8888, i go for 28080, 38080, 48080, 58080, etc... :-D
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.