Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

roedygr

Posts

7

Joined

Sun Dec 04, 2011 2:36 pm

Location

Victoria BC Canada

dreaded Software caused connection abort: socket write error

by roedygr » Sun Dec 04, 2011 6:21 pm

From perusing the net, it seems that the error message "Software caused connection abort: socket write error" just means something went wrong. It shows up in other programs than edtFTnet and other protocols besides FTP. The various explanations as to its cause I don't think fit my case. I wrote little test program just to get familiar with edtFTPnet. I can change directories, find out what directory I am in, but as soon as I try to get a directory listing it fails.

-------------------------PROGRAM--------------------------

/*
* [BulkFTP.java]
*
* Summary: Upload a large set of files with FTP avoiding those already uploaded.
*
* Copyright: (c) 2011 Roedy Green, Canadian Mind Products, http://mindprod.com
*
* Licence: This software may be copied and used freely for any purpose but military.
* http://mindprod.com/contact/nonmil.html
*
* Requires: JDK 1.6+
*
* Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
*
* Version History:
* 1.0 2011-12-03 initial release
*/
package com.mindprod.bulkftp;

import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.net.ftp.FTPException;
import com.enterprisedt.net.ftp.FileTransferClient;

import java.io.IOException;

import static java.lang.System.err;
import static java.lang.System.out;

/**
* Upload a large set of files with FTP avoiding those already uploaded.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2011-12-03 initial releas
* @since 2011-12-03
*/
public class BulkFTP
{
public static void main( String[] args )
{

final String host = "mindprod.com"; // 65.110.21.43
final String username = "roedy.mindprod.com";
final String password = System.getenv( "FTP_PASSWORD" );
final String rootDir = "/com/mindprod/www";

out.println( "logging into " + host + " with username " + username + " and password " + password );

final FileTransferClient ftp = new FileTransferClient();
try
{
ftp.getAdvancedFTPSettings().setConnectMode( FTPConnectMode.ACTIVE );
ftp.getAdvancedFTPSettings().setStrictReturnCodes( false );
ftp.setRemoteHost( host );
ftp.setUserName( username );
ftp.setPassword( password );
ftp.connect();
final String initialDir = ftp.getRemoteDirectory();
out.println( "initial cwd " + initialDir );
ftp.changeDirectory( rootDir );
final String absRootdir = ftp.getRemoteDirectory();
out.println( "abs root dir " + absRootdir );
final String[] descriptions = ftp.directoryNameList(); // <-- dies here
for ( String s : descriptions )
{
out.println( s );
}
ftp.disconnect();
}
catch ( FTPException e )
{
err.println( e.getMessage() + " Unable to proceed" );
e.printStackTrace( err );
System.exit( 1 );
}
catch ( IOException e )
{
err.println( e.getMessage() + " Unable to proceed" );
e.printStackTrace( err );
System.exit( 1 );
}

}
}


-------------------------OUTPUT-----------------------------

Connected to the target VM, address: '127.0.0.1:53145', transport: 'socket'
logging into mindprod.com with username roedy.mindprod.com and password xxxx
initial cwd /com/mindprod/usr/roedy
abs root dir /com/mindprod/www
Software caused connection abort: socket write error Unable to proceed
Disconnected from the target VM, address: '127.0.0.1:53145', transport: 'socket'
com.enterprisedt.net.ftp.ControlChannelIOException: Software caused connection abort: socket write error
at com.enterprisedt.net.ftp.FTPControlSocket.writeCommand(FTPControlSocket.java:1020)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:997)
at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:813)
at com.enterprisedt.net.ftp.FTPControlSocket.sendPORTCommand(FTPControlSocket.java:669)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketActive(FTPControlSocket.java:616)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:583)
at com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2648)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3664)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3756)
at com.enterprisedt.net.ftp.FileTransferClient.directoryNameList(FileTransferClient.java:622)
at com.enterprisedt.net.ftp.FileTransferClient.directoryNameList(FileTransferClient.java:606)
at com.mindprod.bulkftp.BulkFTP.main(BulkFTP.java:62)
no avatar
User

roedygr

Posts

7

Joined

Sun Dec 04, 2011 2:36 pm

Location

Victoria BC Canada

by roedygr » Sun Dec 04, 2011 6:55 pm

I have been reading up a bit on how FTP works. I suspect what is happening is the control socket is working ok, but it fails as soon as it needs to set up the data socket. This would suggest a firewall problem. My router is not blocking any outgoing connections. I don't know how it could deal with incoming connections on random sockets. My ISP told me not to use PASV. Yet other FTP utilities such as FTP voyager and Netload seem to work fine. With my current understanding, that should be impossible.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sun Dec 04, 2011 10:24 pm

This is normally a firewall issue. PORT means the server must connect back to the client, and perhaps this is being blocked.

This could be a client firewall, a firewall in between the client and server, or a server firewall.

Check out the logging in your other clients to see whether PORT or PASV is being used. If you enable logging in edtFTPnet (see the guide) you should be able to quickly see how the commands sent differ. Post them here if you want an opinion.
no avatar
User

roedygr

Posts

7

Joined

Sun Dec 04, 2011 2:36 pm

Location

Victoria BC Canada

by roedygr » Mon Dec 05, 2011 12:24 am

no avatar
User

roedygr

Posts

7

Joined

Sun Dec 04, 2011 2:36 pm

Location

Victoria BC Canada

Re: dreaded Software caused connection abort: socket write e

by roedygr » Mon Dec 05, 2011 1:07 am

[quote="roedygr"]From perusing the net, it seems that the error message "Software caused connection abort: socket write error" just means something went wrong. It shows up in other programs than edtFTnet and other protocols besides FTP. The various explanations as to its cause I don't think fit my case. I wrote little test program just to get familiar with edtFTPnet. I can change directories, find out what directory I am in, but as soon as I try to get a directory listing it fails.

oh Joy, oh Rapture...

I have it working now, both in PASV and ACTIVE mode. The trick was compiling with Jet to create a unique *.exe executable. The PASV version worked without needing an exception, and Windows prompted me to allow the ACTIVE version through. Thanks very much your prompt response.

Who is online

Users browsing this forum: No registered users and 39 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron