You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Anil Philip <go...@yahoo.com> on 2006/10/29 00:54:10 UTC

[commons ftp] help! FTPClient.isConnected() does not work.

In my code, I do:

if(!ftpClient.isConnected()) {
...not connected, so connect to server
}



However, when there is a timeout and the connection is
closed,
FTPClient.isConnected() incorrectly returns true. So
that the if is never entered,
but this exception is thrown when the connection is
assumed to be open, and used.

org.apache.commons.net.ftp.FTPConnectionClosedException:
FTP response 421 received.  Server
closed connection.
	at
org.apache.commons.net.ftp.FTP.__getReply(FTP.java:321)
	at
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:460)
	at
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:520)
	at
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:569)
	at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1248)
	at
org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:1809)


Is this a bug?

thanks,
Anil Philip


 
__________________________________________________________________________________________
Check out the New Yahoo! Mail - Fire up a more powerful email and get things done faster. 
(http://advision.webevents.yahoo.com/mailbeta) 


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


Re: [commons ftp] help! FTPClient.isConnected() does not work.

Posted by Rory Winston <rw...@eircom.net>.
Not without the source. If you have the source and are willing to make a 
change, then you can access the SocketClient's underlying _socket_ 
variable directly.


Anil Philip wrote:
> Is it possible for me to access that call directly?
> (So that my code will work)
> thanks,
> Anil
>
>
> --- Rory Winston <rw...@eircom.net> wrote:
>
>   
>> Thanks Anil.
>>
>> I will change the code for the next version of [net]
>> to use 
>> _socket_.isConnected() instead.
>>
>> Anil Philip wrote:
>>     
>>> In my code, I do:
>>>
>>> if(!ftpClient.isConnected()) {
>>> ...not connected, so connect to server
>>> }
>>>
>>>
>>>
>>> However, when there is a timeout and the
>>>       
>> connection is
>>     
>>> closed,
>>> FTPClient.isConnected() incorrectly returns true.
>>>       
>> So
>>     
>>> that the if is never entered,
>>> but this exception is thrown when the connection
>>>       
>> is
>>     
>>> assumed to be open, and used.
>>>
>>>
>>>       
> org.apache.commons.net.ftp.FTPConnectionClosedException:
>   
>>> FTP response 421 received.  Server
>>> closed connection.
>>> 	at
>>>
>>>       
> org.apache.commons.net.ftp.FTP.__getReply(FTP.java:321)
>   
>>> 	at
>>>
>>>       
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:460)
>   
>>> 	at
>>>
>>>       
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:520)
>   
>>> 	at
>>>
>>>       
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:569)
>   
>>> 	at
>>>       
>> org.apache.commons.net.ftp.FTP.pwd(FTP.java:1248)
>>     
>>> 	at
>>>
>>>       
> org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:1809)
>   
>>> Is this a bug?
>>>
>>> thanks,
>>> Anil Philip
>>>
>>>
>>>  
>>>
>>>       
> __________________________________________________________________________________________
>   
>>> Check out the New Yahoo! Mail - Fire up a more
>>>       
>> powerful email and get things done faster. 
>>     
>>> (http://advision.webevents.yahoo.com/mailbeta) 
>>>
>>>
>>>
>>>       
> ---------------------------------------------------------------------
>   
>>> To unsubscribe, e-mail:
>>>       
>> commons-user-unsubscribe@jakarta.apache.org
>>     
>>> For additional commands, e-mail:
>>>       
>> commons-user-help@jakarta.apache.org
>>     
>>>
>>>
>>>   
>>>       
>>
>>
>>     
> ---------------------------------------------------------------------
>   
>> To unsubscribe, e-mail:
>> commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> commons-user-help@jakarta.apache.org
>>
>>
>>     
>
>
>
>  
> ____________________________________________________________________________________
> Access over 1 million songs - Yahoo! Music Unlimited 
> (http://music.yahoo.com/unlimited)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>
>   



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


Re: [commons ftp] help! FTPClient.isConnected() does not work.

Posted by Anil Philip <go...@yahoo.com>.
Is it possible for me to access that call directly?
(So that my code will work)
thanks,
Anil


--- Rory Winston <rw...@eircom.net> wrote:

> Thanks Anil.
> 
> I will change the code for the next version of [net]
> to use 
> _socket_.isConnected() instead.
> 
> Anil Philip wrote:
> > In my code, I do:
> >
> > if(!ftpClient.isConnected()) {
> > ...not connected, so connect to server
> > }
> >
> >
> >
> > However, when there is a timeout and the
> connection is
> > closed,
> > FTPClient.isConnected() incorrectly returns true.
> So
> > that the if is never entered,
> > but this exception is thrown when the connection
> is
> > assumed to be open, and used.
> >
> >
>
org.apache.commons.net.ftp.FTPConnectionClosedException:
> > FTP response 421 received.  Server
> > closed connection.
> > 	at
> >
>
org.apache.commons.net.ftp.FTP.__getReply(FTP.java:321)
> > 	at
> >
>
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:460)
> > 	at
> >
>
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:520)
> > 	at
> >
>
org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:569)
> > 	at
> org.apache.commons.net.ftp.FTP.pwd(FTP.java:1248)
> > 	at
> >
>
org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:1809)
> >
> >
> > Is this a bug?
> >
> > thanks,
> > Anil Philip
> >
> >
> >  
> >
>
__________________________________________________________________________________________
> > Check out the New Yahoo! Mail - Fire up a more
> powerful email and get things done faster. 
> > (http://advision.webevents.yahoo.com/mailbeta) 
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> >
> >
> >
> >
> >   
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Access over 1 million songs - Yahoo! Music Unlimited 
(http://music.yahoo.com/unlimited)


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


Re: [commons ftp] help! FTPClient.isConnected() does not work.

Posted by Rory Winston <rw...@eircom.net>.
Thanks Anil.

I will change the code for the next version of [net] to use 
_socket_.isConnected() instead.

Anil Philip wrote:
> In my code, I do:
>
> if(!ftpClient.isConnected()) {
> ...not connected, so connect to server
> }
>
>
>
> However, when there is a timeout and the connection is
> closed,
> FTPClient.isConnected() incorrectly returns true. So
> that the if is never entered,
> but this exception is thrown when the connection is
> assumed to be open, and used.
>
> org.apache.commons.net.ftp.FTPConnectionClosedException:
> FTP response 421 received.  Server
> closed connection.
> 	at
> org.apache.commons.net.ftp.FTP.__getReply(FTP.java:321)
> 	at
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:460)
> 	at
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:520)
> 	at
> org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:569)
> 	at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1248)
> 	at
> org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:1809)
>
>
> Is this a bug?
>
> thanks,
> Anil Philip
>
>
>  
> __________________________________________________________________________________________
> Check out the New Yahoo! Mail - Fire up a more powerful email and get things done faster. 
> (http://advision.webevents.yahoo.com/mailbeta) 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>
>   



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