Fedora Linux Support Community & Resources Center
  #1  
Old 10th June 2012, 04:10 AM
mdberger Offline
Registered User
 
Join Date: Oct 2011
Posts: 60
windows_xp_2003firefox
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.
Reply With Quote
  #2  
Old 10th June 2012, 05:07 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,302
linuxfirefox
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
Reply With Quote
  #3  
Old 10th June 2012, 05:27 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105
linuxfirefox
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).
Reply With Quote
  #4  
Old 10th June 2012, 11:12 PM
mdberger Offline
Registered User
 
Join Date: Oct 2011
Posts: 60
windows_xp_2003firefox
Re: tcp/ip server timeout

Quote:
Originally Posted by stevea View Post
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.
Reply With Quote
Reply

Tags
server, tcp or ip, timeout

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh timeout st3ve Using Fedora 4 16th June 2011 03:42 PM
DNS timeout garaden Using Fedora 10 31st July 2009 02:42 PM
Samba print server timeout problem WNorfleet Servers & Networking 3 19th December 2005 05:05 PM
Irregular timeout problems with Fedora Server groovydaz Servers & Networking 0 9th July 2005 11:44 AM


Current GMT-time: 15:23 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat