amethystct
Programmer
Okay who's a ftp wiz?!
We recently moved our servers behind a firewall and were told we had to change our feed programs to use a passive connection. I can get the mode changed to passive and it gets the file but then the connection hangs. Am I closing the connection incorrectly?
Here's a snippet of the code:
// Read bytes from server
System.out.println("Hopefully got the file!: " + getServerReply());
if (getServerReply() >= 200 && getServerReply() < 300) {
success = true;
System.out.println("Success.");
} else {
System.out.println("Not successful: " + getServerReply()); // transfer incomplete
success = false;
}
System.out.println("Close input stream");
in.close();
System.out.println("Close output stream");
fileStream.close();
System.out.println("Close the socket");
sock.close();
System.out.println("Done!");
This is the output:
150 Binary data connection for wamcon3.ok
Hopefully got the file!: 150
226 Binary Transfer complete.
We recently moved our servers behind a firewall and were told we had to change our feed programs to use a passive connection. I can get the mode changed to passive and it gets the file but then the connection hangs. Am I closing the connection incorrectly?
Here's a snippet of the code:
// Read bytes from server
System.out.println("Hopefully got the file!: " + getServerReply());
if (getServerReply() >= 200 && getServerReply() < 300) {
success = true;
System.out.println("Success.");
} else {
System.out.println("Not successful: " + getServerReply()); // transfer incomplete
success = false;
}
System.out.println("Close input stream");
in.close();
System.out.println("Close output stream");
fileStream.close();
System.out.println("Close the socket");
sock.close();
System.out.println("Done!");
This is the output:
150 Binary data connection for wamcon3.ok
Hopefully got the file!: 150
226 Binary Transfer complete.