Re: send command



401anil@xxxxxxxxx wrote:
Hi,
I have written a script in tcl n expect to send a command to a switch
with tenet.
but i am unable to send more than 1024B data using send command i am
executing this script in linux machine please i need ur help here is
the script ........


I'll ask again since last time you didn't answer.
Can you do this from the command line? If your telnet command
line has a buffering issue, then there is nothing expect
can do to change that.

Bruce

#!usr/bin/tcl
package require Tclx
package require Expect
spawn telnet 192.179.0.5

match_max 5000
set bufferContents ""
set full ""
set match ""
set timeout 30
set c "ping6 fe80::207:e9ff:fe09:fb6d%vlan1 "
set a
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111"
set b
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111"
expect {
-nocase -re {Press*} {
send "\r"
exp_continue
}
{#} {
send "ping6 fe80::207:e9ff:fe09:fb6d%vlan1 data-fill $b\r"
}
timeout { puts "FAIL" }
}
expect {
"*#" {
puts "\n its here"
append bufferContents $expect_out(buffer)
puts "contents are : $bufferContents"
}
"Request*" {
puts "Invalid length"
}
}
send "\r"
expect "#"

if { [regexp " is alive," $bufferContents full] } {
puts "match is : $full"
} elseif { [regexp "Invalid length." $bufferContents full] } {
puts "invalid"
}
set len [string length $b]
puts "\n <<<<<<<<<<<<<<<<<< length is : $len >>>>>>>>>>>>>>"

.



Relevant Pages