Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Why SetSocketOption cannot change the KeepAlive time interval

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken - 28 Oct 2004 05:17 GMT
Hi,
I have a C# TCP client program. I want to make use of the KeepAlive
functionality to check that the connection is still alive after some time
interval. I try to use the SetSocketOption method to change the KeepAlive
interval (default is 2 hours) to be shorter, but it doesn't work. The
KeepAlive founction is activated by the SetSocketOption method, but the time
interval is still 2 hours.

This is my code:
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive,
5000);

"client" is the socket in the client side.

I would like to ask two questions:
1. How can I change the KeepAlive time interval?
2. Can I activate the KeepAlive functionality for only one socket and other
TCP progams in the system won't be affected?

Thank you,
Ken
Chris - 29 Oct 2004 18:35 GMT
> Hi,
> I have a C# TCP client program. I want to make use of the KeepAlive
[quoted text clipped - 17 lines]
> Thank you,
> Ken

Hi Ken,

I believe that  the SetSocketOption for KeepAlive just enables/disables
KeepAlive.  It doesn't set the KeepAlive time interval.  This interval should
be configurable (see section 4.2.3.6 of RFC 1122).  This change however would
affect the time interval of all applications with KeepAlive enabled.

Also note that RFC 1122 says that KeepAlive should only be invoked in server
applications.  See the above mentioned section for more details.

As for setting the KeepAliveTime interval, it will be platform specific.  
For example, in Windows 2003 you would want to see
http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/deployguid
e/en-us/Default.asp?url=/resources/documentation/windowsserv/2003/all/deployguid
e/en-us/58767.asp


-Chris

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.