[Twisted-Python] twisted and gprs

John Aherne johna at johnaherne.co.uk
Mon Jan 8 12:46:15 MST 2007

Thanks to Phil, Carl and JPCalderone for the replies.

I'll try and answer them by explaining more clearly what I am trying to 
do. And explaining some terms that I were vague.

The sessions are a connection that I need to keep open -  a combination 
of IP address and source port no - so the server can use the source port 
number that the PDA used when making the initial connection. The PDA 
will need to block on the TCPIP socket waiting for messages to be sent 
to it. It will process the message and then wait again. Provided the PDA 
does not close the socket and lose the connection with the original port 
no, the firewall will let the conversation keep going.

The server will send on the initial source/destination port nos and not 
close the connection. This way the PDA can still be contacted over a 
long period of time. Because the PDA is behind the network firewall, if 
the original port used by the PDA is lost, the server can no longer send 
data to the PDA, since the firewall will not let the traffic through 
even though the IP address had not changed.

As Carl pointed out I will need more than the IP address to identify the 
PDA. I will need an ID from the PDA that is unique so that if the PDA 
comes back in with a different IP address I can pick that up, drop the 
existing IP/port no if I still have it and register it with it's new IP 
address and source port no.

As i write this down, explaining it to myself as much as anyone else, I 
think to myself that the mechanics look very much like an irc 
connection. I might be wrong so please let me know.

The server will need to ping the PDA to confirm the connection is still 
there. If lost it will deregister the PDA and wait for it to reconnect 
again. What I am not sure about with irc is whether I can keep hold of 
the port no used by the PDA as its source port and maintain the 
connection with the IP address/port no combination.

What I would like is if I can find a framework that does most of the 
heavy work with the communications. I can then find a suitable point to 
make some not too difficult changes to accommodate my requirements.

I have done a very simple test using the socket library to confirm that 
the basics do work. The connection stays open and as long as I do not 
close the socket connection at either end and use the same 
source/destination port numbers the traffic flows.And I can push data 
without the PDA having to initiate new connections and requesting data.

I hope this a better explanation than my first post. I am sure there 
will still be bits that might not be clear so let me know and I will 
fill in any gaps.

If it is clear,  what I am looking to find out is which bits of twisted 
I would need to use and what parts would need changing and to what extent.

One final note, there could be around 100 of the PDAs to look after.

Thanks for any feedback.

John Aherne

More information about the Twisted-Python mailing list