![]() |
socket implementation problem ?
I have created a java ftp server and there's a problem when it comes to upload files on my server ( download works fine.. )
Clients using flashfxp can upload only a few bytes ( usually 14kb ) of a file on the server, while other ftp clients ( cute ftp, ws_ftp ) are working fine and upload the file completly. The loop that reads data from the flashfxp DTP socket stream, return EOF after a few byte have been uplaoded, there's no stream or socket close. Any idea where that problem could come from ? ( could be you or java.. i have checked java and found nothing about such issue.. ) |
I have no clue what would cause this. Let me know if you figure anything out.
|
I have finally found the problem, I was calling a inputstream.shutdown() method when I was sending a file or outputstream.shutdown() method when I was receiving a file,
I was doing this for some security and optimization reasons ( make sure that only required streams are open during transactions ), it looks like that on certain socket implementation, the shutdown() method call will cause that behaviour. I do not use this shutdown method anymore, I prefer to have something that works with your client but a little bit less secure. |
FlashFXP uses shutdown() when closing a connection.
Are you setting so_linger before calling shutdown()? |
yeah i tried the so linger setting but it did not help
the only way for me to make that stuff work it to make sure that the socket inputstream or outputstream objects are not shutdowned during the DTP socket initialization. |
I recently discovered a problem in FlashFXP that might explain the compatiblity issue with your FTP server.
Why don't you go ahead and add shutdown() back to your ftp server and give the latest beta a try build 855 |
socket problem
Thanks Bigstar
Unfortunatly your latest build still does not solve my problem. the socket.shutdownoutput() methods are still not working.. when i try to upload a file, the EOF is sent at the first byte.. sessionSocketDTP.shutdownOutput() causes the problem with your client, the same code works perfectly fine with other FTP clients. Well thanks for trying to fix something, but looks like the gremlin is the winner this time :o) If you wanna give it a last try, Here is the method I call to initialize the DTP socket with a comment where the method call causes problems, i hope it will help you a little bit ( even if i doubt about it ) : public void initializeDTPSocket( boolean openInputStream, boolean openOutputStream, boolean useCharSet ) throws IOException { if ( openInputStream && openOutputStream ) { throw new IOException( "Opening DTP output and input at the same time is not allowed" ); } if ( !isPASVMode ) { sessionSocketDTP = getNewDTPSocket( getSessionDetails().getHostAddress(), getSessionDetails().getDTPPort() ); initializeSocket(); } if ( sessionSocketDTP == null ) { throw new IOException( "DTP Socket has not been initialized use PORT or PASV command first" ); } if ( openInputStream ) { if ( useCharSet ) { inputReader = new InputStreamReader( sessionSocketDTP.getInputStream(), getPIrw().getCurrentCharSet() ); } else { input = new BufferedInputStream( sessionSocketDTP.getInputStream(), inputDTPBuffSize ); } // that method call causes the problem when uploading a file sessionSocketDTP.shutdownOutput(); // result : EOF reached after first byte read with method input.read(). } if ( openOutputStream ) { if ( useCharSet ) { outputWriter = new OutputStreamWriter( sessionSocketDTP.getOutputStream(), getPIrw().getCurrentCharSet() ); } else { output = new BufferedOutputStream( sessionSocketDTP.getOutputStream(), outputDTPBuffSize ); } // that call doesn t seems to bring troubles when a file is sent sessionSocketDTP.shutdownInput(); } } sorry for the code indentation |
All times are GMT -5. The time now is 01:00 PM. |
Powered by vBulletin® Version 3.8.11 Alpha 3
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)