View Single Post
Old 06-03-2002, 01:16 PM  
superbonbon
Junior Member
 
Join Date: May 2002
Posts: 5
Default 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 )

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
superbonbon is offline