You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anoop Johnson <an...@symonds.net> on 2004/10/20 13:29:50 UTC

Connection reset during active FTP using Commons Net

Hi,

I'm using the Commons FTP API to transfer a file to an FTP server. The FTP
server is located outside our corporate network and supports only active
FTP.

The connection to the FTP server went through, but it was throwing the
following exception when I tried to put a file or do a directory listing:

java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:168)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
        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:74)
        at
org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInputStream.java:169)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
        at
org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStream.java:104)
        at
org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream.java:520)
        at java.lang.Thread.run(Thread.java:536)

I traced through the code and found that the FTP connection is getting
reset after the client sends the PORT command. After sending the PORT
command, the API tries to get the server's response in the method
__getReply() in FTP.java. The above exception was thrown in the following
line inside __getReply():

String line = _controlInput.readLine();

I'm attaching the test program that I used and the log. The same code
works fine when I ran it from a Windows desktop. The Linux version is SuSE
Linux Enterprise Server 8.0. Could this be because of some firewall
blocking the inbound connection from the FTP server? If so how can I
verify it?

Any pointers on why this happens will be of great help.

Thanks,
Anoop

Re: Connection reset during active FTP using Commons Net

Posted by Mario Ivankovits <ma...@ops.co.at>.
Mario Ivankovits wrote:

> The connection to the FTP server went through, but it was throwing the
>
>> following exception when I tried to put a file or do a directory 
>> listing:
>>
>> java.net.SocketException: Connection reset
>>        at java.net.SocketInputStream.read(SocketInputStream.java:168)
>>        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
>>        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
>>  
>>
> Have you already tried the "passive" mode - using 
> FTPClient.enterLocalPassiveMode()?

Uhm, what a shame, havent read the first prargraph in your e-mail 
clearly enough, sorry for this :-(

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Connection reset during active FTP using Commons Net

Posted by Mario Ivankovits <ma...@ops.co.at>.
Anoop Johnson wrote:

>The connection to the FTP server went through, but it was throwing the
>following exception when I tried to put a file or do a directory listing:
>
>java.net.SocketException: Connection reset
>        at java.net.SocketInputStream.read(SocketInputStream.java:168)
>        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
>        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
>  
>
Have you already tried the "passive" mode - using 
FTPClient.enterLocalPassiveMode()?

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org