java - Apache FTPClient hangs during the retrieveFileStream -
dear have problem code. ftp client hanging when retrieving file "ftpclient.retrievefilestream()". idea can do? using apache commons ftp client v3.4.
- i tried "ftpclient.retrievefile()" did not make difference.
- setting connection , scoket timeout did not help
- setting passive mode did not help
increasing buffer did not help
ftpclient = new ftpclient(); ftpclient.setbuffersize(1024 * 1024); ftpclient.setconnecttimeout(10000); ftpclient.connect(serveraddress); ftpclient.login(username,password); ftpclient.setfiletype(ftp.binary_file_type); ftpclient.enterlocalpassivemode(); ftpclient.setsotimeout(10000); log("retriving file " + remotefilepath + "..."); outputstream output = new fileoutputstream(localfilepath); inputstream inputstream = ftpclient.retrievefilestream(remotefilepath); // here hanging. try { ioutils.copy(inputstream, output); output.flush(); } { ioutils.closequietly(output); ioutils.closequietly(inputstream); ftpclient.completependingcommand(); }
the last message retrieve looking this:
19:58:21.145 [main] info ftpdao: retrieving file /modell/5250/artikel/25777/lg_keh68bgh_1.jpg... 19:58:21.145 [main] info log4jftpcommandlistener - >> pasv 19:58:21.462 [main] info log4jftpcommandlistener - << 227 entering passive mode (195,216,65,165,168,240) 19:58:21.476 [main] info log4jftpcommandlistener - >> retr /modell/5250/artikel /25777/lg_keh68bgh_1.jpg 19:58:21.490 [main] info log4jftpcommandlistener - << 150 connection accepted
when suspend programm debugger, looks hanging @
java.net.socketinputstream.socketread0(filedescriptor, byte[], int, int, int) java.net.socketinputstream.socketread(filedescriptor, byte[], int, int, int) line: 116 java.net.socketinputstream.read(byte[], int, int, int) line: 170 java.net.socketinputstream.read(byte[], int, int) line: 141
regards mark
i had problem too. changed retrievefilestream
retrievefile
. , doesn't hang there anymore.
Comments
Post a Comment