GPRS service fails after a long time


I start a gprs bearer, launch a TCP/IP server, then sit and wait for client connections. THis all works fine. Except that after a day or few days, if there is no activity, I can not connect a client. The FSU20 does not receive any tcp connection events.
I have learned that the GPRS provider may be dropping the connection (the PDP context). So I have tried shutting down the TCP/IP server and the GPRS bearer and restarting them. However I still seem to run into the same problem. Trouble is I have to leave it a few days to see if it works or fails!
In the failed mode I can still connect via serial, AT+COTS gives me the provider, everything looks OK. I just can’t connect!

Any hints?


I think you just have to assume that the GSM provider may close the connection - and design to cope with that!


Any hints as to what will show me that the GPRS link is no longer valid? The at+cops still gives me the correct details in this failed mode. I have a CGREG handler and no events have been seen by that.


maybe ping a server once a day?



subscribe to the adl_gprsSubscribe() events.

This will let you be notified when a whole lot of things happen (such as the network has forced a detachment of the modem). Have a look at section 3.18 of the R7.4 ADL User Guide…

ciao, Dave


Thanks, will do.


But it only relates to the GPRS radio link - it tells you nothing about the IP link from the GPRS network out to the internet.

Operators do drop the IP link from the GPRS network out to the internet for various reasons at various times - and there is no specific indication to the mobile. :frowning:

If you’re using a specific M2M service provider, they should be able to give you details of their policies on this (which may depend on the level of service you’ve subscribed) - but, if you’re just using a standard public network, such technical details are notoriously difficult to obtain (and probably aren’t guaranteed anyhow). :frowning:
See: viewtopic.php?f=34&t=1106
As an aside on using “a standard public network” see also: viewtopic.php?f=34&t=2147

The only way to confirm that the IP link from the GPRS network out to the internet is still working is, as Madouc suggests, to do some kind of “ping”.


Thanks for the confirmation. This seems to be the only way, pinging something. It has worked for a number of days, before loosing the connections previously. But its not reliable.


Radio networks are iherently unreliable - so your application must be designed to cope with loss of the link!


Hello to all,

i think this could be due to a change of IP address

some times the gprs provider changes it every two-three days …

may be you need to test for an IP change and update the clients to switch to the new address

but i don’t know how to read the assigned ip address … i think we have a structure in wip reporting it.

can someone help us ?



No, I don’t think the provider changes it; I think they just drop your link, so you lose it.

It’s then up to you to establish a new link - which, of course, will result in a new IP address…


Us this code snipe to get your current IP assigned by provider (maybe public):

wip_in_addr_t appIpAddr;