How to terminate a telnet session from within your C/C++ program

Discussion in 'C Programming' started by Michael, Jan 27, 2005.

  1. Michael

    Michael Guest

    Dear all,

    Given the following challenge:
    1. The application is an exe on a W2K server
    2. User logs via telnet to the server
    3. After checking the user account and password, a bat file runs
    cmd.exe that starts the app.
    4. The app starts looking for another instance of itself and if it was
    found it will kill the instance (but not the telnet session that
    originally started the instance as described in 1. to 3.)
    5. Since the server allows only 2 telnet sessions, as a consequence,
    the next log-in will be refused even there is only one or none
    application.

    I am looking for a piece of code that will be plugged into the app
    and:
    1. will not only look for aonther instance of itself but also for the
    telnet session that has started the instance and kill this session.

    I appreciate any help/hints you can give us,

    Michael
    Michael, Jan 27, 2005
    #1
    1. Advertising

  2. Michael

    Richard Bos Guest

    (Michael) wrote:

    > I am looking for a piece of code that will be plugged into the app
    > and:
    > 1. will not only look for aonther instance of itself but also for the
    > telnet session that has started the instance and kill this session.


    There is nothing portable that can do this. There might be a way to do
    so for your implementation only (so ask in a newsgroup for your
    compiler), but I wouldn't be surprised at all if there isn't any safe
    way. But surely a better, in any case a more robust, way of doing this
    would be to have the telnet script itself detect that your program has
    ended - early or normally - and end itself when it has?

    Richard
    Richard Bos, Jan 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael
    Replies:
    1
    Views:
    2,668
    Attila Feher
    Jan 27, 2005
  2. Replies:
    5
    Views:
    19,626
  3. Ernesto

    Self terminate a python program

    Ernesto, Nov 15, 2005, in forum: Python
    Replies:
    1
    Views:
    6,847
    Ben Finney
    Nov 15, 2005
  4. Jim Isaacson
    Replies:
    5
    Views:
    593
    Default User
    Nov 5, 2004
  5. Carcarius
    Replies:
    0
    Views:
    279
    Carcarius
    Dec 6, 2007
Loading...

Share This Page