The IAP Info API can be used to query and set internet access point settings for Java applications:
IAPInfo iapinfo = IAPInfo.getIAPInfo(); AccessPoint accesspoint = iapinfo.getAccessPoint("CompanyWLAN");
To make a connection using the retrieved access point, the access point's ID is appended to URL as a parameter:
Connection connection = Connection.open(accesspoint.getURL("http://www.nokia.com"));
The IAP Control API is an extension of the Java Generic Connection Framework (GCF). The Java Generic Connection Framework does not let applications choose between the defined internet access points, instead it always offers the default one. IAP Control API makes access point selection possible for the application, allowing different applications to use different routes towards the desired network(s). This API therefore allows an application to use different access points for different network connections.
Java GCF provides a framework for creating a particular Connection
instance
from a URL using Connector.open(<
URL >[,…])
function. There are different protocol
implementations in Java ME such as TCP, SSL, UDP, HTTP, and HTTPS. Each protocol
conforms to the following URL schema when creating network connections:
{scheme}://[{target}][{parms}]
where {scheme}
is the name of a protocol such as
HTTP. The {target}
is normally some kind
of network address, such as www.nokia.com
. Any {parms}
are
a series of parameters of the format ;x=y
.
The IAP Control feature extends the Java GCF URI scheme definition by adding new optional parameters:
nokia_apnid
for access point selection
by access point ID. It determines the used IAP for the current connection.
nokia_netid
for destination network
selection by network ID. It can be used only with TCP socket connections.
The parameter name is handled by the API in a case-sensitive way and
this part of the URL must not contain any spaces or other special characters!
In order not to interfere with other parameters in the URL, this part of the
URL string is removed before it is transmitted to the web server. The API
can be used with each overloaded version of the Connector.open()
function.
Note: You cannot use the two parameters at the same time.
If any of the parameters are defined, it is always at the end of the URI in the following format:
< protocol >://[< authority >]< path >[?[< query >];{nokia_apnid=< number > | nokia_netid=< number >}]
For example:
Connector.open("http://www.nokia.com:80; nokia_apnid=1"); Connector.open("socket://192.168.1.2:50; nokia_apnid=2"); Connector.open("socket://129.144.111.5:10; nokia_netid=3");
IAP selection prompt is shown every time when the connection is opened using a host name. This is mainly because of the way the native DNS resolver works.