Posted By:
zhebin_cong
Posted On:
Friday, February 17, 2006 06:52 AM
hello all see my program following: public static void main(String args[]) { Socket socket = null; BufferedReader in = null; PrintWriter out = null; String line = null; try { socket = new Socket("myserver", 21); in = new BufferedReader(new InputStreamReader(socket .getInputStream())); out = new PrintWriter(socket.getOutputStream()); out.println("user " + "congzb"); out.println("pass " + "1qazxsw2"); out.println("pwd"); out.println("pasv"); out.println("list"); out.println("quit"); out.flush();
More>>
hello all
see my program following:
public static void main(String args[]) {
Socket socket = null;
BufferedReader in = null;
PrintWriter out = null;
String line = null;
try {
socket = new Socket("myserver", 21);
in = new BufferedReader(new InputStreamReader(socket
.getInputStream()));
out = new PrintWriter(socket.getOutputStream());
out.println("user " + "congzb");
out.println("pass " + "1qazxsw2");
out.println("pwd");
out.println("pasv");
out.println("list");
out.println("quit");
out.flush();
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
out.close();
in.close();
socket.close();
} catch (Exception fe) {
System.out.println("RESOURCE CLOSE EXCEPTION "
+ fe.getMessage());
}
}
}
the trace info as following:
331 Password required for congzb.
230-Last unsuccessful login: Fri Feb 17 02:21:26 EST 2006 on /dev/pts/1 from 9.186.23.101
230-Last login: Fri Feb 17 05:59:26 EST 2006 on ftp from ::ffff:9.186.23.101
230 User congzb logged in.
257 "/home/congzb" is current directory.
227 Entering Passive Mode (9,56,249,42,152,101)
in fact, it hang on "pasv" command. and don't give me the answer of "list" command.
why? thanks
<<Less