• David Timerman

    David Timerman - 2005-07-29

    It appears to be coming from line 210 in DataConnection

                            sock = ssock.accept();

    from the ssock.accept();

    > PORT 10,10,10,152,5,5

    200 PORT Command successful.

    > 200 PORT Command successful.

    > RETR performance.xsd

    > > RETR performance.xsd

    150 Opening ASCII mode data connection for performance.xsd (1704 Bytes).

    > 150 Opening ASCII mode data connection for performance.xsd (1704 Bytes). Accept timed out

        at Method)




    Got IOException while trying to open a socket!

    > Got IOException while trying to open a socket!

    Can't connect socket to ServerSocket

    > Can't connect socket to ServerSocket




    > java.lang.NullPointerException

    I am using an Active connection

    My program was working perfectly up until today. Its task is to Ftp to a specific remote server and download specific files in Binary mode. I am not sure why this is happening - wondering if I am doing something wrong or if there could be a bug... Included is important code in my client application :

      public static void main(String[] args) {
        JftpClient client = new JftpClient();

        File[] files = new File[1];
        files[0]=new File("file1.xsd");

        try {
          client.openConnection(<ip>, <username>,
        catch (Exception e) {

      public void openConnection(String host, String username,
                                          String password) throws Exception {
        Settings.setProperty("jftp.ftpPasvMode", false);
        con = new;
        con.login(username, password);
        // Waits for the connection to be made, otherwise, throws exception
        while (!isConnected) {
          try {
          catch (Exception ex) {
        if (con == null || !isConnected) {
          throw new Exception("Connection could not be established");

       public void downloadFiles(File[] downloads) {
        String parentDir = con.getCachedPWD();
        for (int x = 0; x < downloads.length; x++) {
          File file = downloads[x];
          String filePath = file.getParent();
          //if the file is to be downloaded from a non-parent directory, change the path
          if (filePath != null) {
          String fileName = file.getName();
            //changes directory to the parent if the directory has been altered
          if (filePath != null) {

    If anyone could shed some light on this issue for me that would be very helpful

    Thank you

    • Cyberdemon

      Cyberdemon - 2005-08-05


      My first guess is that you might have some kind of firewall enabled that blocks the incoming request from the server somewhere in your network or that something is running on port 1285 (the port represented by the port command). Can you check that please?

    • David Timerman

      David Timerman - 2005-10-06

      I'm sorry it has been months since i've gotten back to this problem... anyways, it doesnt look like the issue is the firewall - it seems that this error occurs only when a file is not found on the server during a download.

      it fails at " sock = ssock.accept(); " in DataConnection

    • Jake Kasprzak

      Jake Kasprzak - 2005-10-14


      Well, after looking into this a little further, I think I can tell you the best way to deal with this. It does appear that the reason that this exception is thrown is because the file you are trying to download is not there. A timeout will occur at that line if that happens. And if you would prefer to not have that exception thrown, the best way to handle this would be to list the files in the remote directory, then check that list for that file. As you may know, you can use the sortLs() method in to get the list of files, then you can check that array of strings for the file you are trying to download. If you do that, then I'm sure you will not see this exception get thrown again.

      If it does happen again, though, or if you have any further questions or comments, do not hesitate to post them here.



    • David Timerman

      David Timerman - 2005-10-17

      thank you for your help - i figured it would be something like that. i will implement your ls suggestion.

      again, very appreciated


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks