Hi,
I have a telnet client application written in java.
The telnet application which is written in java is generally invoked from my Windows PC as below:
java -jar telnetserver.jar <portnumber of the server>
I want to interact with this telnet client in a tcl script using Expect.
I read some articles informing that Tclblend allows me to interact with java application from a Tcl script.
But I couldn't find exact information about how Expect can be used along with java application inside a Tcl script.
Please let me know how can I accomplish this task.
The below snippet is what I'm thinking of using to perform this task.
Please correct me incase I miss something.
++++++++++++++++++++++++++++++
package require Expect
package require Java
#Spawn a telnet session to the telnet server running on the target device
spawn java -jar telnetserver.jar <port number where Telnet server is listening>
expect "*in:"
send "<username>\r"
expect "*Password:"
send "<password>\r"
#Put a expression which you expect at the command prompt
# For example:
# A prompt like "[anil@Testers anil]$" requires
# expect "*anil]$ "
expect "<expression which we expect at the command prompt><space>"
++++++++++++++++++++++++++++++++++
Thanks In Advance,
Venu Gopal V
|