Having difficult time getting a response from my perl script when using Net::Telnet. The server is not actually a telnet server, but responses to print command from perl. I do get all the correct responses in the "recieved_data.txt" file, but need the returned value.
#!/usr/bin/perl use Net::Telnet (); $host='192.168.1.181'; {$t = new Net::Telnet (Timeout => 10,Input_log => "received_data.txt" +, Prompt => '/bash\$ $/'); $t->open($host); $t->print("AT"); #this is just used to make sure it connects## $t->waitfor('/AT/'); #this is just an echo back of what is sent## $t->waitfor('/OK/i'); #send this to say I'm ready## } {$t->print("AT%23=1234"); #This basically the password to the system# +# $t->waitfor('/AT%23=1234/i'); #Echo back## $t->waitfor('/OK/i'); } { $oid = $t->print("AT1122"); #This is the command to see the state## $oid = $t->waitfor('/AT1122/i'); #Echo back## $oid = $t->waitfor('//'); #this could be 0,1,2...need to converto oid +### #Need this value to check state in SNMP## $t->waitfor('/OK/i'); } $t->close();
In reply to Telnet responses by mikebailey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |