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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: