1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Socket controlSock = new Socket(host, port);
// SshClient
controlSock.setSoTimeout(30000); // timeout if nothing after X s during a read
controlSock.setSoLinger(true, 1); // wait 1s on close
System.out.println("controlSock : "+controlSock.toString());
controlReader = new BufferedReader(new InputStreamReader(controlSock.getInputStream()));
controlWriter = new BufferedWriter(new OutputStreamWriter(controlSock.getOutputStream()));
String buf = controlReader.readLine();
System.out.println("readReply : buf : "+ buf);
String command = "open \"user@host\"";
//command = "sftp -o";
controlWriter.write(command);
controlWriter.write(EOL);
controlWriter.flush();
buf = controlReader.readLine();
System.out.println("USER : buf : "+ buf); |
Partager