commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Hoffer <>
Subject commons-net sending FTP not working on EC2 server
Date Thu, 11 Oct 2012 03:27:46 GMT
I just moved an app over to an EC2 server and I'm having trouble
sending data via FTP.  This has worked for years on a different Linux
server, the new one is Linux too just on Amazon EC2.

The code is really simple...basically...

FTPClient ftp = new FTPClient();
ftp.login(username, password);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(fileBytes);
OutputStream os = ftp.storeFileStream(fileName);

byte buf[] = new byte[8192];
int bytesRead =;
while (bytesRead != -1) {
       os.write(buf, 0, bytesRead);
       bytesRead =;

when I debug blocks forever at the call to storeFileStream().
When it runs while not debugging I get a SocketException (Connection
time out)...not sure if at same line or another such as os.write()..

I was using version 3.0.1, I just upgraded to 3.1 to see if that would
help but it has the same problem.  The only difference I can think of
is that the old server was using Java 6 the new one is Java 7.  One
other thing that is different is that the EC2 has most ports blocked,
I've opened port 21 and UDP/DNS.  Is there any other ports that are
needed for FTP?

What might be causing this?  I'm completely stuck not knowing where to
look at this point.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message