Networking Forums

Networking Forums > Computer Networking > Linux Networking > how to determine users' connection status

Reply
Thread Tools Display Modes

how to determine users' connection status

 
 
ligerdave
Guest
Posts: n/a

 
      05-11-2007, 06:07 PM
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

 
Reply With Quote
 
 
 
 
Dave Vandervies
Guest
Posts: n/a

 
      05-11-2007, 06:16 PM
In article <(E-Mail Removed). com>,
ligerdave <(E-Mail Removed)> 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 (E-Mail Removed)
Unfortunately requiring an operating system to function properly is
beyond the authority of the C language standard.
--Jack Klein in comp.lang.c
 
Reply With Quote
 
Default User
Guest
Posts: n/a

 
      05-11-2007, 06:53 PM
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
 
Reply With Quote
 
steve_schefter@hotmail.com
Guest
Posts: n/a

 
      05-11-2007, 08:01 PM
On May 11, 2:07 pm, ligerdave <david.c...@gmail.com> 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

 
Reply With Quote
 
phil-news-nospam@ipal.net
Guest
Posts: n/a

 
      05-12-2007, 04:13 PM
In comp.os.linux.development.system ligerdave <(E-Mail Removed)> 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-(E-Mail Removed) |
|------------------------------------/-------------------------------------|
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect Connection Status Aviator Wireless Networks 3 12-29-2006 02:45 AM
How to determine if strangers using wireless connection? Indigo Wireless Networks 2 04-21-2006 11:26 PM
How to read Connection Status Jon Cameron Wireless Networks 3 02-26-2006 04:22 AM
event ID 3109 The redirector failed to determine the connection ty Jason Blake Windows Networking 1 02-09-2006 07:43 PM
wrong connection status Peter Welk Wireless Networks 0 12-22-2004 02:26 PM



1 2 3 4 5 6 7 8 9 10 11