FTP Remote Connection Problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: FTP Remote Connection Problem

  1. #1
    Join Date
    Feb 2008
    Posts
    966

    FTP Remote Connection Problem

    Ok, I am having a bit of a problem connecting to a remote server. I am trying to pull files from a remote server, all firewall configurations have been made and I can connect and transfer files using FileZilla(and other ftp protocol ide's) so I know that I am able to connect via ftp.

    The problem comes when I try to do this in Java using org.apache.commons.net.SocketClient.connect. I am using java 1.4.2 for this project, ant builds to build a .sar file that gets run by Phoenix 4.0.3.

    Here are the two error codes, the first one is setting the ip to the address, the second one is setting the ip to the address followed by :3556 where 3556 is the port number.

    Connection closed without indication.
    org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:253)
    at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:321)
    at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:522)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:249)
    at com.monitor.FTPResource.getTimeStamp(FTPResource.java:228)
    at com.monitor.FTPResource.lastModified(FTPResource.java:203)
    at com.monitor.Resource.testModifiedAfter(Resource.java:99)
    at com.monitor.ActiveMonitor.run(ActiveMonitor.java:332)
    at java.lang.Thread.run(Thread.java:534)
    xx.xx.xx.xxx:xxxx
    java.net.UnknownHostException: xx.xx.xx.xxx:xxxx
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
    at java.net.Socket.connect(Socket.java:464)
    at java.net.Socket.connect(Socket.java:414)
    at java.net.Socket.<init>(Socket.java:310)
    at java.net.Socket.<init>(Socket.java:125)
    at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:52)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:161)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:249)
    at com.monitor.FTPResource.getTimeStamp(FTPResource.java:228)
    at com.monitor.FTPResource.lastModified(FTPResource.java:203)
    at com.monitor.Resource.testModifiedAfter(Resource.java:99)
    at com.monitor.ActiveMonitor.run(ActiveMonitor.java:332)
    at java.lang.Thread.run(Thread.java:534)
    Note: I have purposfully placed in x's for the ip and port on purpose. Trust me that those are accurate .

    The code to try to connect is as follows:
    Code:
     
    
    FTPClient l_ftp =
    new FTPClient();
    try { l_ftp.connect(m_hostName);

    Where m_hostName is the name of the ip that I supply (either as the raw IP or the IP followed by the ort#).

    I am really not sure why I am unable to connect. If you need more information about this, please let me know.


  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: FTP Remote Connection Problem

    N/M, bad programmer, BAD... after looking at the api for commons-net I figured it out, I know RTFM!

    the call should be client(strIP,intPort);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center