[ http://issues.apache.org/jira/browse/NET-146?page=comments#action_12459460 ] Koloom commented on NET-146: ----------------------------
Following is an InputStream implementation which slows down the data transfer (upload). Just to make your testing easier ;-). I could not attach the complete test since I use another layer on top of commons-net and I am not free to distribute it. public class DelayedByteArrayInputStream extends InputStream { private byte[] data; private int position; private long chunkDelay; private final static int CHUNK = 10000; public DelayedByteArrayInputStream(byte[] data, long time) { this.data = data; position = 0; double x = time / (data.length / CHUNK); chunkDelay = Math.round(Math.ceil(x)); } public int read() throws IOException { if (position % CHUNK == 0) { try { Thread.sleep(chunkDelay); } catch (InterruptedException e) { throw new IOException("sleep interrupted"); } } return position < data.length ? data[position++] : -1; } } > wrong handling of timeouts > -------------------------- > > Key: NET-146 > URL: http://issues.apache.org/jira/browse/NET-146 > Project: Commons Net > Issue Type: Bug > Affects Versions: 1.4 Final > Environment: linux 2.6, java 1.5.0_08 (but most probably any > environment) > Reporter: Koloom > > If you set a timeout on the control connection and then make a data transfer > (upload, download) which takes longer than that timeout, the client throws > the following exception. It seems like the client tries to read something > from the control connection while the data transfer is in progress and then > it just throws an exception. It makes the application think that the transfer > failed even though it succeeded. > aused by: java.net.SocketTimeoutException: Read timed out > at java.net.SocketInputStream.socketRead0(Native Method) > at java.net.SocketInputStream.read(SocketInputStream.java:129) > at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) > at java.io.BufferedInputStream.read(BufferedInputStream.java:235) > at java.io.FilterInputStream.read(FilterInputStream.java:66) > at java.io.PushbackInputStream.read(PushbackInputStream.java:120) > at > org.apache.commons.net.io.FromNetASCIIInputStream.__read(FromNetASCIIInputStream.java:75) > at > org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInputStream.java:170) > at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) > at java.io.BufferedInputStream.read(BufferedInputStream.java:235) > at > org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.java:114) > at > org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:535) > at java.lang.Thread.run(Thread.java:595) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]