All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jasper Spaans <lartc@spaans.ds9a.nl>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Detecting stale TCP/IP
Date: Tue, 29 Jul 2003 10:24:02 +0000	[thread overview]
Message-ID: <marc-lartc-105947436230606@msgid-missing> (raw)
In-Reply-To: <marc-lartc-105946877025796@msgid-missing>

On Tue, Jul 29, 2003 at 08:56:24AM +0000, Ben Clewett wrote:
> Dear lartc,
> 
> I have a TCP/IP server connecting to a GPRS PDA.
> 
> Unfortuntatelly GPRS seems unstable, and for this reason or another, a 
> interupt to the TCP/IP connection (like switching the clinet off 
> suddenly) does not terminate the TCP/IP connection.  It can still be 
> seen in 'netstat', and a test by the application shows it present.  It 
> may time out after about 40 minutes.
> 
> My real problem is a call to 'write' in non-blocking mode returns 
> success when the other end of the TCP/IP connection is not there.
> 
> Does any member know a reference to where I can test for the reply 
> TCP/IP 'ACK' packet for this write call, and therefore timeout and 
> terminate the connection?

You can try using the ioctl TIOCOUTQ, see socket(7). Although this manpage
states otherwise, at least on 2.4.21 and newer it returns the number of
unacked bytes.

Implement a select-loop, and see if the value of this ioctl changes. If not,
close the connection, and the kernel should handle the rest.


VrGr,
-- 
Jasper Spaans                 http://jsp.vs19.net/contact/

<=      Het bedrijf van de appelcomputer is niet      =>
<=    verantwoordelijk voor de omzettingsprecisie.    =>
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2003-07-29 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29  8:56 [LARTC] Detecting stale TCP/IP Ben Clewett
2003-07-29 10:24 ` Jasper Spaans [this message]
2003-07-29 14:55 ` Ben Clewett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-105947436230606@msgid-missing \
    --to=lartc@spaans.ds9a.nl \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.