* @throws ConfigurationUnacceptableValue This exception is thrown if
* a value, that is being set, is not acceptable.
*/
private void checkPort() throws ConfigurationUnacceptableValue{
if(solingertimeout < 1){
throw new ConfigurationUnacceptableValue(String.format("So linger timeout is" +
"set to %d, where it should be atleast 0. Aborting.", solingertimeout));
}
if(sotimeout < 1){
throw new ConfigurationUnacceptableValue(String.format("So timeout is" +
"set to %d, where it should be atleast 0. Aborting.", sotimeout));
}
if(useServer){
if(port < 1 && port > MAXPORT){
throw new ConfigurationUnacceptableValue(String.format("The port given for " +
"the non persistent server is %d, which is more than the " +
"allowed maximum of %d", port, MAXPORT));
}
if(maxAllowedConnectedClients < 0){
throw new ConfigurationUnacceptableValue(String.format("The maximum allowed connected clients " +
"is %d, where it is allowed to be minimum 0.", maxAllowedConnectedClients));
}
}
if(usePServer){
if(persistentPort < 1 && persistentPort > MAXPORT){
throw new ConfigurationUnacceptableValue(String.format("The port given for " +
"the persistent server is %d, which is more than the " +
"allowed maximum of %d", persistentPort, MAXPORT));
}
if(maxAllowedConnectedPC < 0){
throw new ConfigurationUnacceptableValue(String.format("The maximum allowed connected persistent clients " +
"is %d, where it is allowed to be minimum 0.", maxAllowedConnectedPC));
}
}
if(useServer && usePServer){
if(port == persistentPort){
throw new ConfigurationUnacceptableValue(String.format("The persistent server and the non persistent one are" +
"expected to run on the same port %d, but this is not possible. Aborting", port));
}
if(acceptNP){
throw new ConfigurationUnacceptableValue("You are not allowed to have both servers running and" +
"still allow the persistent one to recieve non persistent connections.");
}
}
}