> 5.1 | IP Service

> Apart from the standard Java IP networking interfaces (UDPDatagramConnection, SocketConnection, ...) the ME also supports a set of Internet Services controlled by AT command. There are some correlations between the Java and the AT IP Services.

> • | The connection profile 0 is also used by Java: when Java starts up a networking connection it tries to set and activate connection profile 0 with the parameters configured by AT^SJNET or in the connector.open method.

> • | Java tries to (re-)use an active Internet Service profile: if using connection profile 0 fails, because e.g. this (or another) connection profile is already used by the Internet Services, Java networking also uses this, already active, profile.

> • | Deactivation of the connection profile happens when all applications are finished: Java has its networking idle time. For the Internet Services an inactivity timeout referred to as parameter <inactTO> is available (configurable by AT^SICS and AT^SCFG).

> So that means that Java networking and AT Internet Services can be used in parallel but care has to be taken about configuring and activation of the connection profile. In the simplest case use connection profile 0 for the Internet Services and set the parameters to the same values as the Java networking parameters. This way it makes no difference whether the connection is activated by the Internet Services or Java.
> There are some aspects which have to be kept in mind for all IP Services (Java and AT command):

> • | When an open TCP connection is cut (e.g. the other side dies/is switched off) it takes around 10 minutes during which retransmissions are send, until the situation is detected as an error (in Java an exception is thrown).

> • | The number of IP services used in parallel should be kept small. An active IP service uses up resources and may deteriorate the overall performance.

> • | If a user rapidly closes and opens TCP/IP connections (e.g. SocketConnection, HTTPConnection), a ConnectionNotFoundException reading "No buffer space available" may be thrown, explaining that all TCP/IP socket resources are exhausted. In the worst case, opening further TCP/IP connections is locked for up to 60 seconds.

> • | If a service is re-opened on the same port shortly after having closed the ServerSocketConnection, the ServerSocketConnection may not work properly. To ensure that the service works correctly the host is required to wait at least two minutes before reopening a server.

> • | For information about the bearer state, use the specific IP service command AT^SICI and, in addition, the general network commands AT+COPS and/or AT+CREG.

> Some Java products feature the BearerControl class. This class provides bearer state information and a method to hang-up.