473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

TCP option Keepalive.

Hello.

I sometimes get this error message "An existing connection was forcibly
closed by the remote host" for no reason what so ever in my program. I was
wondering keepalives would help in this matter. My program runs fine and
then all of a sudden the client dies and this message is what is left in the
server logs.

If I was to enable keepalive would the server and client both need it
enabling in the programs ? or just the client ? or just the server ?

If any has any ideas why this would happen let me know.

Thanks
Kalpesh Modha

Ps VS 2003, .NET 1.1 Sp1 Windows xp pro Sp2,
Nov 16 '05 #1
4 4190
How long does the client stay connected. From what I remember the KeepAlive
option was designed for long running connections such as those used by
Telnet and is only sent every couple of hours or so. Although it is possible
to bring this time down. There is some problem with changing the value
though but I can't quite remember what. I think it might that if you chnage
it the change is global i.e. affects all of the TCP connections. The advice
I have seen is to implment your own ping mechanism which kicks in once the
connection has been idle for a set period of time. If the two machines are
not directly connected i.e. there are routers/repeaters/gateways between the
two machines then this could indicate a problem with the router. Which could
be dropping what it thinks of as an idle connection in favour of something
more active.

A good refeence book on TCP/IP is

TCP/IP Illustrated Volume 1: The Protocols
W. Richard Stevens
Addison Wesley Professional Computing Series
0-201-63346-9

Paul.

"Kalpesh Modha" <ka***********@btinternet.com> wrote in message
news:ON**************@TK2MSFTNGP12.phx.gbl...
Hello.

I sometimes get this error message "An existing connection was forcibly
closed by the remote host" for no reason what so ever in my program. I was wondering keepalives would help in this matter. My program runs fine and
then all of a sudden the client dies and this message is what is left in the server logs.

If I was to enable keepalive would the server and client both need it
enabling in the programs ? or just the client ? or just the server ?

If any has any ideas why this would happen let me know.

Thanks
Kalpesh Modha

Ps VS 2003, .NET 1.1 Sp1 Windows xp pro Sp2,

Nov 16 '05 #2
Hello.

Thanks for the information provided.

The program(client) can stay connected
for 7 -8 hours and then all of a sudden just die. I do have an OK message
sent every 50 seconds from the client to keep the connectin up.

The werid thing is that there are services also written in C# which run on
the same machine as the service the client connects too and again these
produce the same message.

I was thinking of running a network sniffer to see why end actually forces
the closure.

regards
Kal.
"Paul O'Connell" <po*@globalnet.co.uk> wrote in message
news:t8********************@brightview.com...
How long does the client stay connected. From what I remember the
KeepAlive
option was designed for long running connections such as those used by
Telnet and is only sent every couple of hours or so. Although it is
possible
to bring this time down. There is some problem with changing the value
though but I can't quite remember what. I think it might that if you
chnage
it the change is global i.e. affects all of the TCP connections. The
advice
I have seen is to implment your own ping mechanism which kicks in once the
connection has been idle for a set period of time. If the two machines are
not directly connected i.e. there are routers/repeaters/gateways between
the
two machines then this could indicate a problem with the router. Which
could
be dropping what it thinks of as an idle connection in favour of something
more active.

A good refeence book on TCP/IP is

TCP/IP Illustrated Volume 1: The Protocols
W. Richard Stevens
Addison Wesley Professional Computing Series
0-201-63346-9

Paul.

"Kalpesh Modha" <ka***********@btinternet.com> wrote in message
news:ON**************@TK2MSFTNGP12.phx.gbl...
Hello.

I sometimes get this error message "An existing connection was forcibly
closed by the remote host" for no reason what so ever in my program. I

was
wondering keepalives would help in this matter. My program runs fine and
then all of a sudden the client dies and this message is what is left in

the
server logs.

If I was to enable keepalive would the server and client both need it
enabling in the programs ? or just the client ? or just the server ?

If any has any ideas why this would happen let me know.

Thanks
Kalpesh Modha

Ps VS 2003, .NET 1.1 Sp1 Windows xp pro Sp2,


Nov 16 '05 #3
That sounds like something more fundamental is wrong. I've written programs
in C# that have stayed connected to their servers for days, well probably
weeks actually. If this problem is affecting serveral different programs
then running somehting like ethereal would be a good idea. the other think
to check is does it affect any other programs. If you have time perhaps you
should try writting the client in something like C++ and not use C#/.Net. It
doesn't have to be a full implementation just enough to do something useful
and see if that also suffers from the problem. That will at least remove
..Net from the equation. The other thing to try is a really basic client in
C# and then keep adding functionality until it stops working. That might
narrow it down to a particular piece of functionality.

Thats about all I can think of I'm afraid.

Paul.

"Kalpesh Modha" <ka***********@btinternet.com> wrote in message
news:#3**************@tk2msftngp13.phx.gbl...
Hello.

Thanks for the information provided.

The program(client) can stay connected
for 7 -8 hours and then all of a sudden just die. I do have an OK message sent every 50 seconds from the client to keep the connectin up.

The werid thing is that there are services also written in C# which run on
the same machine as the service the client connects too and again these
produce the same message.

I was thinking of running a network sniffer to see why end actually forces
the closure.

regards
Kal.
"Paul O'Connell" <po*@globalnet.co.uk> wrote in message
news:t8********************@brightview.com...
How long does the client stay connected. From what I remember the
KeepAlive
option was designed for long running connections such as those used by
Telnet and is only sent every couple of hours or so. Although it is
possible
to bring this time down. There is some problem with changing the value
though but I can't quite remember what. I think it might that if you
chnage
it the change is global i.e. affects all of the TCP connections. The
advice
I have seen is to implment your own ping mechanism which kicks in once the connection has been idle for a set period of time. If the two machines are not directly connected i.e. there are routers/repeaters/gateways between
the
two machines then this could indicate a problem with the router. Which
could
be dropping what it thinks of as an idle connection in favour of something more active.

A good refeence book on TCP/IP is

TCP/IP Illustrated Volume 1: The Protocols
W. Richard Stevens
Addison Wesley Professional Computing Series
0-201-63346-9

Paul.

"Kalpesh Modha" <ka***********@btinternet.com> wrote in message
news:ON**************@TK2MSFTNGP12.phx.gbl...
Hello.

I sometimes get this error message "An existing connection was forcibly
closed by the remote host" for no reason what so ever in my program. I

was
wondering keepalives would help in this matter. My program runs fine and then all of a sudden the client dies and this message is what is left
in the
server logs.

If I was to enable keepalive would the server and client both need it
enabling in the programs ? or just the client ? or just the server ?

If any has any ideas why this would happen let me know.

Thanks
Kalpesh Modha

Ps VS 2003, .NET 1.1 Sp1 Windows xp pro Sp2,



Nov 16 '05 #4
thanks for your help.
"Paul O'Connell" <po*@globalnet.co.uk> wrote in message
news:1L********************@brightview.com...
That sounds like something more fundamental is wrong. I've written
programs
in C# that have stayed connected to their servers for days, well probably
weeks actually. If this problem is affecting serveral different programs
then running somehting like ethereal would be a good idea. the other think
to check is does it affect any other programs. If you have time perhaps
you
should try writting the client in something like C++ and not use C#/.Net.
It
doesn't have to be a full implementation just enough to do something
useful
and see if that also suffers from the problem. That will at least remove
.Net from the equation. The other thing to try is a really basic client in
C# and then keep adding functionality until it stops working. That might
narrow it down to a particular piece of functionality.

Thats about all I can think of I'm afraid.

Paul.

"Kalpesh Modha" <ka***********@btinternet.com> wrote in message
news:#3**************@tk2msftngp13.phx.gbl...
Hello.

Thanks for the information provided.

The program(client) can stay connected
for 7 -8 hours and then all of a sudden just die. I do have an OK

message
sent every 50 seconds from the client to keep the connectin up.

The werid thing is that there are services also written in C# which run
on
the same machine as the service the client connects too and again these
produce the same message.

I was thinking of running a network sniffer to see why end actually
forces
the closure.

regards
Kal.
"Paul O'Connell" <po*@globalnet.co.uk> wrote in message
news:t8********************@brightview.com...
> How long does the client stay connected. From what I remember the
> KeepAlive
> option was designed for long running connections such as those used by
> Telnet and is only sent every couple of hours or so. Although it is
> possible
> to bring this time down. There is some problem with changing the value
> though but I can't quite remember what. I think it might that if you
> chnage
> it the change is global i.e. affects all of the TCP connections. The
> advice
> I have seen is to implment your own ping mechanism which kicks in once the > connection has been idle for a set period of time. If the two machines are > not directly connected i.e. there are routers/repeaters/gateways
> between
> the
> two machines then this could indicate a problem with the router. Which
> could
> be dropping what it thinks of as an idle connection in favour of something > more active.
>
> A good refeence book on TCP/IP is
>
> TCP/IP Illustrated Volume 1: The Protocols
> W. Richard Stevens
> Addison Wesley Professional Computing Series
> 0-201-63346-9
>
> Paul.
>
> "Kalpesh Modha" <ka***********@btinternet.com> wrote in message
> news:ON**************@TK2MSFTNGP12.phx.gbl...
>> Hello.
>>
>> I sometimes get this error message "An existing connection was
>> forcibly
>> closed by the remote host" for no reason what so ever in my program.
>> I
> was
>> wondering keepalives would help in this matter. My program runs fine and >> then all of a sudden the client dies and this message is what is left in > the
>> server logs.
>>
>> If I was to enable keepalive would the server and client both need it
>> enabling in the programs ? or just the client ? or just the server ?
>>
>> If any has any ideas why this would happen let me know.
>>
>> Thanks
>> Kalpesh Modha
>>
>> Ps VS 2003, .NET 1.1 Sp1 Windows xp pro Sp2,
>>
>>
>
>



Nov 16 '05 #5

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

Similar topics

1
by: Cliff Harris | last post by:
I am trying to automate a series of form posts on a website. This site requires that my session be kept alive through successive posts (it basically tracks me by a sessionid, and if I get a new...
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,...
1
by: okaminer | last post by:
Hi This is for the experts I have override the GetWebRequest method and set the keepalive property to false in order to overcome a certain in .NET web service problem. My problem now is that...
2
by: Volker Hetzer | last post by:
Hi! I've got a problem with the GC.keepalive function, as used in the examples at http://msdn2.microsoft.com/en-US/library/system.gc.keepalive.aspx .. There they have a class "Example",...
3
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
3
by: Ryan Liu | last post by:
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...
1
by: semedao | last post by:
Hi, I want to implement keepalive on connected socket between 2 machines , that can be behind NAT. I saw the SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1) and the...
2
by: Atmapuri | last post by:
Hi! I was looking at the details of how KeepAlive works to handle my unmanaged code interop. Several question came up. Assuming I have: public Test2(Object a) { }
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.