 |
 |
 |
 |
| Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc. |

10th June 2012, 04:10 AM
|
|
Registered User
|
|
Join Date: Oct 2011
Posts: 60

|
|
|
tcp/ip server timeout
In F16, in my home grown tcp/ip server (in C++), I would like
to take action if a client remains connected, there is no traffic
in either direction for, say, 5 minutes. Is there something within
the tcp/ip software that can do this, or do I have to code it?
Thanks,
Mike.
|

10th June 2012, 05:07 AM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,302

|
|
|
Re: tcp/ip server timeout
Not only do you not have to code it - you can't code it. When there is (or isn't) traffic on the stack, user apps, aside from the one with the open socket can't detect the traffic.
I suggest you study the firewall capability. You can likely disconnect any connection based on traffic, there (kernel feature, not a userspace feature).
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
|

10th June 2012, 05:27 AM
|
|
Registered User
|
|
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105

|
|
|
Re: tcp/ip server timeout
After looking at the firewall, it depends on what actions you want, and what your service is.
IF it must save state, then it will have to be coded to recognize a disconnect (a socket error), and that may be a bit difficult to distinguish as different than a network reset caused by other situations (such as a forced termination of a remote client type of thing).
|

10th June 2012, 11:12 PM
|
|
Registered User
|
|
Join Date: Oct 2011
Posts: 60

|
|
|
Re: tcp/ip server timeout
Quote:
Originally Posted by stevea
Not only do you not have to code it - you can't code it. When there is (or isn't) traffic on the stack, user apps, aside from the one with the open socket can't detect the traffic.
I suggest you study the firewall capability. You can likely disconnect any connection based on traffic, there (kernel feature, not a userspace feature).
|
Not only can I code it, but from wear I am now, it is almost trivial. The server is based on Posix threads, making extensive use of Condition Variables, with each server connection creating a thread. As you may know, the command pthread_cond_wait has a built in timeout capability which I have used extensively in other programs. It would be nicer, however, if the socket could do it.
Yes, the firewall could do it, but from a structural point of view, this would be the last choice.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 15:23 (Thursday, 23-05-2013)
|
|
 |
 |
 |
 |
|
|