Re: Detecting Closed COnnections
- From: "SRLoka" <ls_reddy@xxxxxxxxxxx>
- Date: Thu, 19 May 2005 14:51:02 -0400
Thanks. The RTO throws some light on the problem I am having.
I think I have to build a workaround for that.
"Alan J. McFarlane" <alanjmcf@xxxxxxxxxxxxxxxxx> wrote in message
news:428b1fc6$0$562$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> In article news:ewhz11iWFHA.3488@xxxxxxxxxxxxxxxxxxxx, SRLoka wrote:
>> I have a TCP server to which some third party mobile devices send
>> periodic data and I respond with just a simple 2 byte ack. This is
>> written in C#. Occasionally(very rarely - once a month may be), I
>> send data(50 to 100 bytes - some config commands) to these devices on
>> the same connection. If a device disconnects(the connection could be
>> terminated by cellular coverage loss or device powering down etc),
>> how can I detect that socket has been disconnected ?
>> If I send any bytes to a device that has been powered down(my test
>> device), the Socket Send does NOT fail or thow an exception. I am not
>> sure if this is a C# /.Net problem or a general problem with Sockets.
>
> When TCP gets no response from a peer during a connection, it will retry a
> number of times; this is by default five times in Windows. If it still
> gets no response it will then abort the connection. A Winsock programmer
> will get an error the next time send, recv etc is called. I don't know
> that .Net does...
>
> Note that the time to fails depends on the round-trip time that the
> connection is experiencing, the retries are send at exponentially
> increasing intervals. If the RTO (retransmission timeout) is calculated
> to be 5 seconds then retries will be send at 5, 10, 20, 40, 80, and the
> after a further 160 seconds it will fail, so the total retry time is 5
> minutes 15 seconds (315 seconds).
>
>> Should I set the SO_SNDBUF to zero and the TCP_NODELAY (I havent't
>> figured out those in C# yet) ? Is it OK to do this for such an app ?
>>
> No.
> --
> Alan J. McFarlane
> http://www.alanjmcf.me.uk/
> Please follow-up in the newsgroup for the benefit of all.
>
.
- Follow-Ups:
- Re: Detecting Closed COnnections
- From: Alan J. McFarlane
- Re: Detecting Closed COnnections
- References:
- Detecting Closed COnnections
- From: SRLoka
- Re: Detecting Closed COnnections
- From: Alan J. McFarlane
- Detecting Closed COnnections
- Prev by Date: Re: Re-use an address/port when binding a socket used for Sending data
- Next by Date: Passing parameters to a ftp script
- Previous by thread: Re: Detecting Closed COnnections
- Next by thread: Re: Detecting Closed COnnections
- Index(es):
Relevant Pages
|