need help urgently - Unix

This is a discussion on need help urgently - Unix ; Hi, I have written a script in tcl and expect i have to send more than 1024B data to a switch. I can send that with multiple send commands with one expect but I want to use 1 send command ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: need help urgently

  1. need help urgently

    Hi,

    I have written a script in tcl and expect i have to send more than
    1024B data to a switch. I can send that with multiple send commands
    with one expect but I want to use 1 send command only but i am unable
    to send that much. I am using linux machine to run this script. One of
    my friend said that it is a limitation of the shell that we r using if
    this is correct then tell me how to increse that shell size?
    Here I am sending my script please tell me the required
    modifications..
    #!/usr/bin/tcl
    package require Tclx
    package require Expect

    spawn telnet 192.179.0.5
    set command "ping6 fe80::218:feff:fe86:e480%vlan1 data-fill "
    set a
    "11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 11111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111"
    set b
    "11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 11111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 111111111111111111111111
    111111111111111111111111111111"
    match_max 100000
    expect "Press"
    send -- "\r"
    expect "*#" {
    send -- "$command"
    send -- "$a"
    send -- "$b"
    send -- "\r"
    }
    expect {
    "*#" {
    puts "\n its here"
    append bufferContents $expect_out(buffer)
    puts "contents are : $bufferContents"
    }
    }

    .............................
    regards,
    Anil A Kumar

  2. Re: need help urgently

    anil_ec1 wrote:
    > I have written a script in tcl and expect i have to send more than
    > 1024B data to a switch. I can send that with multiple send commands
    > with one expect but I want to use 1 send command only but i am unable
    > to send that much. I am using linux machine to run this script. One of
    > my friend said that it is a limitation of the shell that we r using if
    > this is correct then tell me how to increse that shell size?


    I do not see any evidence that you're using a shell at all. It looks
    like you're having Expect interact directly with the telnet command.

    But more importantly, I do not see what value there is in doing everything
    in one single send. Since you are using telnet, you are using a TCP
    connection, and TCP connections do not have any notion of message
    boundaries. They are just a stream of bytes with no guarantees about
    how many bytes will arrive at once.

    Could you explain what you hope to accomplish or what problem you are
    trying to solve by doing a single send?

    - Logan

+ Reply to Thread