3

My method must trying to connect to some other DB server. When I run my application on Linux Server - there was all OK. When I run it on Windows OS - 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 anybody give me some advice? Thanks.

Khrystyna Makar
  • 312
  • 4
  • 15

1 Answers1

2

AS/400 connections use a lot of network ports which must be available to you.

Try disabling all firewalls between you and the server and try again. This include the software firewall (may be part of the antivirus suite) on the Windows system

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • 1
    Also, you shouldn't have to set the socket properties. – David G Dec 03 '14 at 14:26
  • Thanks for answer. But I can't disable firewalls. Maybe you know another way, that can help me? – Khrystyna Makar Dec 03 '14 at 15:24
  • 1
    In that case you will need help from the AS/400 administrators. – Thorbjørn Ravn Andersen Dec 03 '14 at 15:40
  • 1
    You can find a list of the ports that JT400 needs here: http://www-03.ibm.com/systems/power/software/i/toolbox/faq/ports.html – David G Dec 03 '14 at 16:19
  • The code worked when connecting from a Linux system. Therefore it makes more sense to assume the problem is somewhere on the Windows system, rather than what you refer to as the AS/400 (probably an IBM Power System) – WarrenT Dec 05 '14 at 05:56
  • @WarrenT "firewalls" include the software firewall (and antivirus) on the Windows system. I can see this is not completely clear from the current wording. – Thorbjørn Ravn Andersen Dec 05 '14 at 12:47
  • Hi @KhrystynaMakar, did you manage to resolve this? I am facing an almost identical issue, the connections worked on a Linux server but am facing socket timeout problems on windows server. Appreciate any clues you could provide. – aram063 Jul 22 '15 at 22:18