• Post Reply Bookmark Topic Watch Topic
  • New Topic

Valid Port Range  RSS feed

 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with 64k to work with the valid port range is (1024 x 64) so thats 0 through 65535, problem is the server can listen on port 0 for example, but the client cannot connect, or similar possible problems, my feeling on this is that we should allow all between that range, even well known reserved ports, but it should be the users reposibility to ensure that on their operating system the port configured can be used, is this correct?
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I did. Just make sure you document your assumptions.
 
Ta Ri Ki Sun
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Damian Ryan:
This is what I did. Just make sure you document your assumptions.


agreed, done it is then, thank you
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If the port number is out of range catch the exception also. It is advisable to catch the following exception:
catch( IllegalArgumentException illegalArgumentException )
{
System.out.println( " Port number is out of range. It is recommended to use valid port number.");
System.exit( 0 );
}
Cheers
Srinivas
SCJP,SCJD
 
Let's go to the waterfront with this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!