无法使用Java套接字连接到在Tandem / NonStop中运行的应用程序服务器

时间:2016-10-12 14:31:59

标签: java sockets hp-nonstop tandem

我是Java套接字编程的新手,我正在尝试使用Java套接字程序连接到运行在 Tandem / NonStop 中的服务器。 这种联系被拒绝了。 以下是我的Java程序:

try {           
    Socket clientSocket = new Socket();
    clientSocket.setKeepAlive(true);
    clientSocket.setReuseAddress(true);
    clientSocket.setTcpNoDelay(true);
    clientSocket.setSoTimeout(120000); 
    clientSocket.setSendBufferSize(65535);
    clientSocket.connect(new InetSocketAddress(serverAddress, serverPort), 10000);

    OutputStream outstream = clientSocket.getOutputStream(); 
    outstream.flush();
    outstream.close();
    clientSocket.close();
    } catch (Exception e) {
    e.printStackTrace();
    }   

下面是错误堆栈跟踪:

java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at com.connect.socket.TestConnection.main(TestConnection.java:23)

注意 - 对于在Tandem / NonStop中运行的服务器,我正在运行 HPE NonStop TCP / IP Programming Mannual中的示例C TCP服务器程序 /强>

我需要一些帮助才能将我的java客户端程序连接到在Tandem / NonStop中运行的服务器。

1 个答案:

答案 0 :(得分:0)

The issue was caused by an error in the server while binding the socket to the port.