[Twisted-Python] twisted and gprs

Andreas Kostyrka andreas at kostyrka.org
Mon Jan 8 17:01:04 EST 2007


* John Aherne <johna at johnaherne.co.uk> [070108 22:28]:
> I'm obviously missing some obvious point I think.
> 
> I need to be sure that the connection keeps on using the same source/destination ports for the duration, so the firewall lets the conversation carry on.
> 
> Provided I don't close the socket at either end will the PDA and server carry on using the same set of source/destination ports.
> 
> The test I did I purposely took note of the port used by the PDA as the network people told me to make sure I kept them the same. I then forced the server to send using that port as 
> the destination. Over the time frame of about 40  minutes I did not need to issue any keepalives. I would rather not issue keepalives since this will cost money on a gprs network based 
> on data usage.

The huge problem here is, that there are no (repeat no) assertations
how long firewalls keep their association. Worse, you cannot be even
be sure that the IP addresses of your client are unique. Technically,
they have to unique up to the NAT gateway.

So basically, going the TCP way, with heart beats (that might need
automatic/manual tuning, depending upon the network) is a safe
conservative solution.

Furthermore, GPRS is usually billed at 10/100KB increments. So doing a
one byte keepalive message every minute, in both directions, would
mean 5000 minutes or 50000 minutes before the keep alives cause real
costs. While making the GPRS timeout implies a new connection, and
lost money, because the payment increments start from zero.

So sending a small keepalive packet is a sensible thing to do.

Andreas




More information about the Twisted-Python mailing list