Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-307

One of the "connect" method in class org.apache.commons.net.SocketClient doesn't handle connection timeout properly

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None
    • None
    • Not applicable

    Description

      org.apache.commons.net.SocketClient method connect (line 225) doesn't use the configured timeout value.

      Original code:

      SocketClient.java (line 225)
          public void connect(String hostname, int port,
                              InetAddress localAddr, int localPort)
          throws SocketException, IOException
          {
              _socket_ = _socketFactory_.createSocket(hostname, port, localAddr, localPort);
              _connectAction_();
          }
      

      Working alternative:

      SocketClient.java (line 225)
          public void connect(String hostname, int port,
                              InetAddress localAddr, int localPort)
          throws SocketException, IOException
          {
              _socket_ = _socketFactory_.createSocket();
              _socket_.bind(new InetSocketAddress(localAddr, localPort));
              _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
              _connectAction_();
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            sg sg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: