How to interact with telnet

  • Aravinda

    Aravinda - 2009-02-12

    Hi All,

    I have this code interacting with telnet, I could able to spwan the telnet but unable to interact with the same.

    One end My program is running which is reading and writing to telnet. Other end I need to have telnet sends message, for which I created a small example before going ahead which is not working.

    Please can any one suggest me where I am wrong.

    spawn telnet localhost 4444

    expect "PASS" { puts "Program is pass\n"}
    send "execute test\r"

    My program prints PASS or FAIL based on what telnet sends message. What's wrong here?

    I tried putting send before and after expect both did not work. Telnet opens properly.


    • Aravinda

      Aravinda - 2009-02-12

      I sorry for bothering, it solved my issues. I have put send before expect. Thanks.


Log in to post a comment.