This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Valid Port Range Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Valid Port Range" Watch "Valid Port Range" New topic
Author

Valid Port Range

Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
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?
Damian Ryan
Ranch Hand

Joined: May 09, 2003
Posts: 117
This is what I did. Just make sure you document your assumptions.


Always proofread carefully to see if you any words out.
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Damian Ryan:
This is what I did. Just make sure you document your assumptions.

agreed, done it is then, thank you
SrinivasMA Srini
Greenhorn

Joined: Feb 21, 2003
Posts: 28
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Valid Port Range
 
Similar Threads
Is this controlling flow with exceptions?
<<< (large value)
IS such TYPE OF QUESTION ASKED IN SCJP REAL EXAM :((
NX: validation of the IP or HostName
Using Glassfish instead of Axis2 in Eclipse