473,463 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

what does SocketOptionName.KeepAlive mean?

Hi,

SocketOptionName.KeepAlive is a bool or an int value?

Is it "belongs to" SocketOptionLevel.Socket?

What does value 0 means? Is that meaning always "keep alive", or never "send
keep-alives"?

And what does "Send keep-alives" mean anyway?

Thanks a million?
Ryan
Jul 16 '06 #1
3 11943
Hi Ryan,

SocketOptionName.KeepAlive must be associated with a TCP Socket and supplied
as a Boolean value, true or false, to the SetSocketOption method.

See section 4.2.3.6 TCP Keep-Alives of RFC 1122 for the standardized
design:

http://www.faqs.org/rfcs/rfc1122.html

In short, enabling keep-alives causes a packet to be sent every 2 hours, by
default, to keep the connection alive when there has been no data sent by
the application within that 2 hour period. In practice, however, a Socket
connection will be closed long before that 2 hour period if no data is sent
within that interval.

- David Sexton

"Ryan Liu" <ad********@online.sh.cnwrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
Hi,

SocketOptionName.KeepAlive is a bool or an int value?

Is it "belongs to" SocketOptionLevel.Socket?

What does value 0 means? Is that meaning always "keep alive", or never
"send
keep-alives"?

And what does "Send keep-alives" mean anyway?

Thanks a million?
Ryan


Jul 16 '06 #2
DC
>"In practice, however, a Socket connection will be closed long before that
>2 hour period >if no data is sent within that interval."
Why so Dave? I have never seen that happen.

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:uI**************@TK2MSFTNGP05.phx.gbl...
Hi Ryan,

SocketOptionName.KeepAlive must be associated with a TCP Socket and
supplied as a Boolean value, true or false, to the SetSocketOption method.

See section 4.2.3.6 TCP Keep-Alives of RFC 1122 for the standardized
design:

http://www.faqs.org/rfcs/rfc1122.html

In short, enabling keep-alives causes a packet to be sent every 2 hours,
by default, to keep the connection alive when there has been no data sent
by the application within that 2 hour period. In practice, however, a
Socket connection will be closed long before that 2 hour period if no data
is sent within that interval.

- David Sexton

"Ryan Liu" <ad********@online.sh.cnwrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
>Hi,

SocketOptionName.KeepAlive is a bool or an int value?

Is it "belongs to" SocketOptionLevel.Socket?

What does value 0 means? Is that meaning always "keep alive", or never
"send
keep-alives"?

And what does "Send keep-alives" mean anyway?

Thanks a million?
Ryan



Jul 16 '06 #3
Hi DC,

I was referring to the fact that sockets in .NET are used mostly for Web
Services, remoting or ASP.NET applications, which are all disconnected
models (i.e. one connection per request, although in remoting there may be
several requests per connection if submitted within a specific interval), or
custom services that have built-in timeouts way before 2 hours since the
longer a socket is left open the bigger the security risk. 2 hours is quite
a lot of time to wait for a response.

"DC" <***@***.comwrote in message
news:ux**************@TK2MSFTNGP05.phx.gbl...
"In practice, however, a Socket connection will be closed long before
that 2 hour period >if no data is sent within that interval."

Why so Dave? I have never seen that happen.

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:uI**************@TK2MSFTNGP05.phx.gbl...
>Hi Ryan,

SocketOptionName.KeepAlive must be associated with a TCP Socket and
supplied as a Boolean value, true or false, to the SetSocketOption
method.

See section 4.2.3.6 TCP Keep-Alives of RFC 1122 for the standardized
design:

http://www.faqs.org/rfcs/rfc1122.html

In short, enabling keep-alives causes a packet to be sent every 2 hours,
by default, to keep the connection alive when there has been no data sent
by the application within that 2 hour period. In practice, however, a
Socket connection will be closed long before that 2 hour period if no
data is sent within that interval.

- David Sexton

"Ryan Liu" <ad********@online.sh.cnwrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
>>Hi,

SocketOptionName.KeepAlive is a bool or an int value?

Is it "belongs to" SocketOptionLevel.Socket?

What does value 0 means? Is that meaning always "keep alive", or never
"send
keep-alives"?

And what does "Send keep-alives" mean anyway?

Thanks a million?
Ryan




Jul 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nathan Kerr | last post by:
I have been working with KB Article 812404 "HOW TO: Write Pluggable Protocol to Supprot FTP in Managed Classes by Using Visual Bassic.NET". I have modified the code to run on a Pocket PC. In the...
2
by: the6campbells | last post by:
Vendors such as ORACLE document how they support the server being configured to provide dead connection detection. I see no documentation in the IBM manuals or support site notes that suggest that...
3
by: PHLICS_Admin | last post by:
Hi All, Following code is used to set multicast interface : IPAddress ipLan = IPAddress.Parse("..."); int iIP = (int)(ipLan.Address) ; ...
12
by: David Sworder | last post by:
Hi, I'm writing an application in which a client (C#/WinForms) and server (C#/service) interact with one another. The client establishes a "session" with the server but for scalability reasons...
0
by: Kevin | last post by:
Hi, How can you set up the timeout values of the KeepAlive Socket option like you do using WSAIoctl and SIO_KEEPALIVE_VALS using C++ ? Searching about this I found several post of people using...
0
by: Ziphyre | last post by:
Hi, I can't send 'Connection: Keep-Alive' property in the second connection of my HttpWebRequest. Suppose: HttpWebRequest hreq = ..... hreq.KeepAlive = true; HttpWebResponse hresp =...
0
by: Greg | last post by:
I have a problem with KeepAlives. I need to use them for crawling a secure server, but if I crawl too long the application memory keeps increasing and doesn't decrease. After lots of testing,...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.