• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Connection timed out: Could be due to invalid connection

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Apache FTPServer implemented on a production aix machine. The user can log in but when they attempt to send a file I get the following error:
[ WARN] 2007-11-28 10:14:59,850 FtpDataConnection.getDataSocket()
java.net.SocketException: Connection timed out:could be due to invalid address
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:336)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:201)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:188)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.connect(Socket.java:428)
at java.net.Socket.<init>(Socket.java:335)
at java.net.Socket.<init>(Socket.java:179)
at org.apache.ftpserver.FtpDataConnection.getDataSocket(FtpDataConnectio
at org.apache.ftpserver.FtpRequestImpl.getDataInputStream(FtpRequestImpl
at org.apache.ftpserver.command.STOR.execute(STOR.java:110)
at org.apache.ftpserver.RequestHandler.service(RequestHandler.java:282)
at org.apache.ftpserver.RequestHandler.run(RequestHandler.java:244)
at java.lang.Thread.run(Thread.java:568)

I have highlighted where this occurs in the following method. This is when the service attempts to establish a socket for the user to use to send the file:
public synchronized Socket getDataSocket() {

// get socket depending on the selection
dataSoc = null;
IDataConnectionConfig dataConfig = fconfig.getDataConnectionConf();
try {
if(isPort) {
int localPort = dataConfig.getActiveLocalPort();
if(secure) {
ISsl ssl = dataConfig.getSSL();
if(ssl == null) {
throw new FtpException("Data connection SSL not configured");
if(localPort == 0) {
dataSoc = ssl.createSocket(null, address, port, false);
else {
InetAddress localAddr = dataConfig.getActiveLocalAddress();
dataSoc = ssl.createSocket(null, address, port, localAddr, localPort, false);
else {
if(localPort == 0) {
>>> dataSoc = new Socket(address, port);
else {
InetAddress localAddr = dataConfig.getActiveLocalAddress();
dataSoc = new Socket(address, port, localAddr, localPort);
else if(isPasv) {
dataSoc = servSoc.accept();
catch(Exception ex) {
log.warn("FtpDataConnection.getDataSocket()", ex);

return dataSoc;

When I run the service on my development server it works fine. Can anyone tell me whether or not this is happening due to filewall restrictions or some other configuration issue on the production server? If it is firewall related how can articulate to my infrastructure staff what I suspect the problem is?

Lasagna is spaghetti flvored cake. Just like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic