how to determine users' connection status - Networking

This is a discussion on how to determine users' connection status - Networking ; hi all, i wonder if anyone can help me with this. im writing a program in C under linux environment which can be connected to through telnet. in this program, i have to manage the user information peacefully under any ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: how to determine users' connection status

  1. how to determine users' connection status

    hi all,

    i wonder if anyone can help me with this. im writing a program in C
    under linux environment which can be connected to through telnet. in
    this program, i have to manage the user information peacefully under
    any circumstances. so far, if user enters quit or exit command, the
    function will clear up everything nicely. however, i ran into this
    crux that what if user terminate the telnet client or let's say in
    case the user's computer's power went off.
    so my question is very straight forward, how can i deal with cases
    like this? please help. thank you all


  2. Re: how to determine users' connection status

    In article <1178906862.098495.311600@w5g2000hsg.googlegroups.c om>,
    ligerdave wrote:
    >hi all,
    >
    >i wonder if anyone can help me with this. im writing a program in C
    >under linux environment which can be connected to through telnet.


    I'm reading this in comp.lang.c, where the correct answer to your question
    is "You'll have to use something system-specific".

    I think the unix answer to your question is "handle SIGHUP". The people in
    the comp.os.linux.* newsgroups you crossposted to might have better ideas.

    Followups set. comp.os.linux.* readers: Please remove comp.lang.c from
    the crosspost list in your replies to the OP.


    dave

    --
    Dave Vandervies dj3vande@csclub.uwaterloo.ca
    Unfortunately requiring an operating system to function properly is
    beyond the authority of the C language standard.
    --Jack Klein in comp.lang.c

  3. Re: how to determine users' connection status

    ligerdave wrote:

    > hi all,
    >
    > i wonder if anyone can help me with this. im writing a program in C
    > under linux environment which can be connected to through telnet.


    This question has nothing to do with the C programming language. Any
    network question is platform-specfic, and platform-specific questions
    are not topical here. Please remove comp.lang.c from any replies.

    Thanks from the folks in clc.




    Brian

  4. Re: how to determine users' connection status

    On May 11, 2:07 pm, ligerdave wrote:
    > however, i ran into this
    > crux that what if user terminate the telnet client or let's say in
    > case the user's computer's power went off.
    > so my question is very straight forward, how can i deal with cases
    > like this?


    This is turned on by default, but it takes about two hours for the
    server to notice that the client has gone away. You can shorten
    this with:
    on = 1;
    setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on));
    value = 2 * 60; /* every 2 minutes */
    setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, (char *)&value,
    sizeof(value));

    Regards,
    Steve


  5. Re: how to determine users' connection status

    In comp.os.linux.development.system ligerdave wrote:

    | i wonder if anyone can help me with this. im writing a program in C
    | under linux environment which can be connected to through telnet. in
    | this program, i have to manage the user information peacefully under
    | any circumstances. so far, if user enters quit or exit command, the
    | function will clear up everything nicely. however, i ran into this
    | crux that what if user terminate the telnet client or let's say in
    | case the user's computer's power went off.
    | so my question is very straight forward, how can i deal with cases
    | like this? please help. thank you all

    You will either know about it quickly or delayed. You could choose to
    expedite the delayed cases by instituting your own timeout rules. But
    in any case, you have to decide what to do in the case of disconnection.
    You could choose to force the equivalent of logging out by causing the
    same logout code to be run (and be sure it is coded to be able to deal
    with the fact that the connection is no longer active). Or you could
    choose to leave the user status intact, ready to be re-associationed with
    a connection once the user returns. You may also choose to place a time
    limit on the un-associated user state and automatically log it out if the
    user does not return in sufficient time.

    What is to be done needs to be decided by you when you implement this.
    Or you can choose to implement a variety of choices for the administrator
    to choose from. But you cannot expect us to choose for you, because if
    we do, you will end up with a wide variety of different opinions and have
    probably even more choices to make.

    --
    |---------------------------------------/----------------------------------|
    | Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
    | first name lower case at ipal.net / spamtrap-2007-05-12-1107@ipal.net |
    |------------------------------------/-------------------------------------|

+ Reply to Thread