Terminating a telnet session - Protocols

This is a discussion on Terminating a telnet session - Protocols ; Hi, I'm trying to nicely/cleanly terminate a telnet session, but I'm unsure how to do this with c-kermit 8.0.209. I'm polling a telnet server every five minutes, and have discovered that after a few hours the server doesn't take any ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Terminating a telnet session

  1. Terminating a telnet session

    Hi,

    I'm trying to nicely/cleanly terminate a telnet session, but I'm unsure
    how to do this with c-kermit 8.0.209.

    I'm polling a telnet server every five minutes, and have discovered
    that after a few hours the server doesn't take any more connections. I
    suspect that's because I was just closing each connection, rather than
    using the server's "logoff" command.

    I've added a logoff command to my script. My first problem is that
    even if I wait for the "Logging off." text from the server, kermit
    still closes the connection before the server closes its end.

    In an attempt to fix that problem, I added a "bye" command at the very
    end of the script. However, now the "bye" command fails (I assume)
    because the connection has closed by the time the "bye" is executed.

    Is there some way to ask kermit to wait until the connection is closed?

    Thanks for your thoughts,

    Matthew


    Script copied below:

    #!/usr/bin/kermit +

    set host 192.168.1.1

    set input echo on

    input 10 Login:
    if failure exit 1 No login prompt
    output [username]\13

    input 10 Password:
    if failure exit 1 No password prompt
    output [password]\13

    input 10 -->
    if failure exit 1 No command line prompt
    output ip list interfaces\13

    input 10 -->
    if failure exit 1 No command prompt after listing interfaces
    output user logout\13

    input 10 Logging out.
    if failure exit 1 Failure to correctly close connection (didn't receive
    text)

    bye
    if failure exit 1 Failure to correctly close connection ('bye' errored)
    if success exit 0 Success

  2. Re: Terminating a telnet session

    "Matthew Walker" wrote in message
    news:ctupi6$uru$1@lust.ihug.co.nz...
    > Hi,
    >
    > I'm trying to nicely/cleanly terminate a telnet session, but I'm unsure
    > how to do this with c-kermit 8.0.209.



    I am somewhat suspect of your analysis but you may want to
    try the following command:

    set exit on-disconnect on

    When you close the session at the teelnet server end
    the connection is dropped and
    kermit is notified and
    the kermit session is ended.

    Regards...Dan.



  3. Re: Terminating a telnet session

    On 2005-02-04, Matthew Walker wrote:
    : I'm trying to nicely/cleanly terminate a telnet session, but I'm unsure
    : how to do this with c-kermit 8.0.209.
    :
    : I'm polling a telnet server every five minutes, and have discovered
    : that after a few hours the server doesn't take any more connections. I
    : suspect that's because I was just closing each connection, rather than
    : using the server's "logoff" command.
    :
    Telnet are supposed automatically log out a session if it closed from the
    client end, and free up any resources, such as pseudoterminals. Often
    the reason for inability to create a new session is the ptys are all used
    up, which could be the fault of the Telnet server. If explicitly logging
    out on the server side fixes the problem, good.

    : I've added a logoff command to my script. My first problem is that
    : even if I wait for the "Logging off." text from the server, kermit
    : still closes the connection before the server closes its end.
    :
    Instead of waiting for text, you can wait for the connection to be closed.
    Example:

    lineout logoff # Send "logoff"
    for \%i 10 1 -1 { # Wait 10 sec for connection to close
    if not open connection break # This is the test
    xecho " \%i" # Still open - count down
    }
    echo
    if open connection { # If still open close it from client.
    echo Connection still not closed - closing it now.
    close connection
    }

    : In an attempt to fix that problem, I added a "bye" command at the very
    : end of the script. However, now the "bye" command fails (I assume)
    : because the connection has closed by the time the "bye" is executed.
    :
    No, it's because you don't have a Kermit server on the far end. BYE
    sends a particular kind of Kermit protocol packet. You probably should
    have a manual where you can look up the commands:

    http://www.columbia.edu/kermit/ck60manual.html

    - Frank

+ Reply to Thread