My method should try to connect to another database server. When I run my application on Linux Server, everything was fine. When I run it on Windows - I have java.net.SocketTimeoutException: Read timed out
private boolean pingServer(String host) { String username = "username"; String password = "password"; boolean successful; AS400 as400 = new AS400(host, username, password); SocketProperties socketProperties = as400.getSocketProperties(); socketProperties.setLoginTimeout(TIMEOUT_MILLISEC); socketProperties.setSoTimeout(TIMEOUT_MILLISEC); as400.setSocketProperties(socketProperties); try{ successful = as400.validateSignon(); } catch (AS400SecurityException e) { successful = true; } catch (IOException e) { successful = false; } catch (TransactionException e) { successful = false; } as400.disconnectAllServices(); as400 = null; return successful; }
Can someone give me some advice? Thanks.
source share