tags:

views:

33

answers:

2

i'm getting error in java ftp code.

SimpleFTP could not request passive mode. i copied this code from net. but it's not working

    sendLine("PASV");
    String response = readLine();
    System.out.println(response);
    System.out.println(response);
    if (!response.startsWith("227")) {
        throw new IOException("SimpleFTP could not request passive mode: " + response);
    }
A: 

It looks like you're able to connect to the ftp server - otherwise you had received IOExceptions or NullPointerExceptions much earlier.

Problem is, that you can't establish a passive mode connection. If the server is a standard product, then I assume, it would respond correctly with a 227 message.

If I had to debug, I'd start with the following:

  1. use a normal shell based ftp client and try to enter passive mode manually. Maybe you get a different response, maybe the server just sends one empty line before the real message
  2. use a network sniffer like wireshark to monitor traffic.
  3. try to connect to a different ftp server
  4. check firewall settings - those may block passive mode because it uses different ports
Andreas_D
ok. thanks Andreas.. I'll try and tell u..
kumar_v
i got it Andreas.. Actually problem is in my server as u told. But my in clients server the code is working well. thanks for your effort..
kumar_v
A: 
Devon_C_Miller