Code:
public class Connect implements Runnable{
Socket socket;
BufferedReader in;
PrintStream out;
public Connect() {
try{
socket = new Socket("ftp.myftp.de",21);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out=new PrintStream(socket.getOutputStream());
Thread s=new Thread(this);
s.setPriority(Thread.MIN_PRIORITY);
s.start();
out.println("USER anonymous");
out.println("PASS [email]anonym@anonym.de[/email]");
out.println("SYST");
out.println("PWD");
out.println("PASV");
out.println("LIST");
} catch (UnknownHostException ex) {System.out.println("Host:"+ex);
} catch (IOException ex) {System.out.println("s:"+ex);
}
}
public static void main(String[] args) {
Connect connect = new Connect();
}
public void run() {
while(true){
try {
System.out.println(in.readLine());
} catch (IOException ex) {
}
}
}
}
Der Befehl um die server liste zu bekommen dürfte doch eigendlich stimmen leider wird aber keine liste versendet. Was mach ich falsch?? Die verbindung zum ftp wird ohne probleme aufgebaut.