We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reported by shamsnez...@gmail.com, May 22, 2010 What steps will reproduce the problem?
I want to use expect4j for ftp but it is not working, the following is my code
public static void main( String[] args ) { String command1 = "ftp"; String command2 = "open 127.0.0.1"; String command3 = "get ftp.txt ftp.txt"; final String username = "msn"; final String password = "nezami"; try { System.out.println( "FtpTest started ..." ); Expect4j expect = ExpectUtils.spawn( command1 ); expect.setDefaultTimeout( Expect4j.TIMEOUT_DEFAULT ); expect.send( command2 + "\n" ); DataClosure userNameClosure = new DataClosure( expect, username ); DataClosure passwordClosure = new DataClosure( expect, password ); Match match[] = { new GlobMatch( "User", userNameClosure ), new GlobMatch( "Password", passwordClosure ) }; expect.expect( match ); expect.send( command3 + "\n" ); expect.close(); System.out.println( "FtpTest completed ..." ); } catch ( Exception ex ) { ex.printStackTrace(); } }
public class DataClosure implements Closure { Expect4j expect; String data; public DataClosure() { } public DataClosure( Expect4j expectParam, String dataParam ) { expect = expectParam; data = dataParam; } public void run( ExpectState state ) throws Exception { try { expect.send( data + "\n" ); } catch ( Exception e ) { System.out.println(e.getMessage()); Expect4j.log.warning( e.getMessage() ); } System.out.println(data +" sent"); state.addVar( data, Boolean.TRUE ); state.exp_continue(); } }
What is the expected output? What do you see instead? It should download a existing file from ftp to current directory
What version of the product are you using? On what operating system? version 1.0 on windows xp3
Please provide any additional information below.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Reported by shamsnez...@gmail.com, May 22, 2010
What steps will reproduce the problem?
I want to use expect4j for ftp but it is not working, the following is
my code
What is the expected output? What do you see instead?
It should download a existing file from ftp to current directory
What version of the product are you using? On what operating system?
version 1.0 on windows xp3
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: