Issue Details (XML | Word | Printable)

Key: NET-24
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Matt Parker
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Net

[net] Commons RLogin timeout

Created: 16/Jun/04 10:17 PM   Updated: 03/Sep/08 12:17 PM
Return to search
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 2.0

Time Tracking:
Not Specified

Environment:
Operating System: All
Platform: PC

Bugzilla Id: 29613
Resolution Date: 17/Feb/08 11:07 PM


 Description  « Hide
When calling the connect method on org.apache.commons.net.bsd.RLoginClient,
timeout can take 10 minutes +.

I have found that this is down to the RCommandClient connect method.

The exception to catch should be a BindException. The logic here is that so
long as we have got a valid local port and address (no BindException) then we
shouldn't bother trying all of the other local ports. If this is adopted, then
a connect exception is thrown from the connect method indicating that the remote
server is not present or responding.

Please see snippet from the corrected connect method below.

for (localPort = MAX_CLIENT_PORT; localPort >= MIN_CLIENT_PORT; --localPort)
{
try

{ _socket_ = _socketFactory_.createSocket(host, port, localAddr, localPort); }

// catch (SocketException e)
catch (BindException e)

{ continue; }

break;
}



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Steve Cohen added a comment - 26/Jun/04 12:06 PM
reopen after 1.2.2 release

Henri Yandell made changes - 16/May/06 09:42 AM
Field Original Value New Value
issue.field.bugzillaimportkey 29613 12341515
Henri Yandell made changes - 16/May/06 11:48 AM
Component/s Net [ 12311127 ]
Project Commons [ 12310458 ] Commons Net [ 12310487 ]
Key COM-1363 NET-24
Affects Version/s 1.2 Final [ 12311661 ]
Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
Henri Yandell made changes - 16/May/06 12:24 PM
Affects Version/s 1.2 Final [ 12311773 ]
Rory Winston made changes - 17/Feb/08 11:07 PM
Resolution Fixed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Fix Version/s 2.0 [ 12312040 ]
Repository Revision Date User Message
ASF #628575 Sun Feb 17 23:08:14 UTC 2008 rwinston NET-24
Files Changed
MODIFY /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/bsd/RCommandClient.java

Ivaylo Ivanov added a comment - 03/Sep/08 12:17 PM
I don't think the bug is fixed in 2.0. The following code is from Revision 658518:

for (localPort = MAX_CLIENT_PORT; localPort >= MIN_CLIENT_PORT; --localPort)
{
try

{ _socket_ = _socketFactory_.createSocket(host, port, localAddr, localPort); }

catch (BindException be) { continue; }
catch (SocketException e)
{ continue; } }
break;
}

if (localPort < MIN_CLIENT_PORT)
throw new BindException("All ports in use or insufficient permssion.");

connectAction();
}

To fix the bug the "catch (SocketException e)" has to be removed completely.