Is there a class that has defined constants for common port numbers like 80, 443, 21?
The only way right now I found is using getDefaultPort
on URL that has a http
, https
or ftp
schema, but it looks excessive to just get a constant.
I'm asking because I don't want to throw a bunch of magic numbers around the code and I assume there should be a place with those constants somewhere (e.g. we have one for UTF8 now).
Not that I know of, but I am curious too. That would be nice. I know this is not an "answer," but in case you wanted to create your own, here is a table that I use (I would have put it in a comment, but I can't paste photos):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With