[Twisted-Python] twisted gprs

John Aherne johnaherne at rocs.co.uk
Thu Jan 10 05:16:15 EST 2008


Carl

Thanks for the reply.

I see now. I did take a look at the TCP book and see what you mean.

What I am trying to do is:--

I have a GPS app on the pda that can transmit every 30 secs or some other
parameterised time frame. This uses a port of its own.

I have another app on the same pda that receives ad hoc messages from the
server and acknowledges these with a message. This is done on a different
port.

For the pda app that waits for messages from the server, I hold a dict of
connections to talk back on.

If the pda can't receive I would like to report back very quickly that it is
not connected.

In theory, if I transmit gps every 30 secs that will keep the connection
open from the pda and is in effect a keepalive. Except when someone is in a
basement or tunnel when the gprs might disappear.

One thought I had was to do a callLater on the server of say 30secs once I
had sent the message, and check whether I had seen a response to that
message within the timeframe. If not I could drop the connection from my
dict and wait for the pda to reconnect with maybe a different IP and port.

Since the gps is send only from the pda I am not too worried if that fails
every now and then. It can just reconnect as and when.

I assume that what I am suggesting is a version of application acks as you
mention. Just nice if someone could confirm that it makes some sense.

Once again Thanks.

John Aherne

-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com]On Behalf Of Carl Zmola
Sent: 10 January 2008 00:06
To: Twisted general discussion
Subject: Re: [Twisted-Python] twisted gprs


John Aherne wrote:
> Is there any call I can make use of to be able to detect the failed send
> before the connection finally is broken.
In general, there is no way to know if a connection is broken.
The standard way to do this is to send a heartbeat message every x
seconds if there is no other communication on the connection.
On the server, you keep a watchdog timer and wait 2x seconds.  You reset
the timer on every communication.
This can be tuned as you see fit, but it has to be done in your application.

The trade off is that if you want to know instantly that a connection is
down, you need to be sending data constantly.

Carson suggested some ways to tweek TCP, and if you have control of the
TCP stack, it is tweakable, but it is not portable.

Carl
zmola at acm.org

_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list