The UDP Connection Bundle wraps a connection factory implementing the datagram scheme. This scheme provides UDP based connection that can serve as an underlying layer for various protocols. It can be used by bundles which need communication with the local or remote OSGi framework.
Contents:
The JAR file of this bundle is udpconn.jar, located in the bundles folder.
|
Note: If the bundle is started on the Standard Version of the framework, the connection APIs are exported by the Connector Service Bundle. If the bundle is started on the Connector Version of the framework, these APIs are exported by the System Bundle.
Note: If the bundle is started on ProSyst mBS,
the com.prosyst.util.ref package is exported by the ProSyst Util
Bundle. If it is started on an OSGi framework provided by another vendor, the
package is exported by the ProSyst Util Full Bundle.
None.
This service publishes the org.osgi.service.io.ConnectionFactory
interface and represents a connection factory for the OSGi communication model,
described in the OSGi IO Connector Service Specification. It is used by the
OSGi Connector Service (exported by the Connector Service Bundle or by the System Bundle,
depending on the version of the framework) for creating connections over the
datagram scheme.
The datagram scheme provides UDP-based connections using the standard
Java platform API for UDP sockets (contained in the java.net package:
DatagramSocket, DatagramPacket, etc.). It supports connections
for sending and/or for receiving.
Each created connection implements two interfaces: javax.microedition.io.DatagramConnection,
which is a subinterface of Connection, and ConnectionNotifier,
which registers listeners for sending connections. A connection also extends
java.util.Dictionary. The Dictionary is used to store
connection-related properties (described later).
Note: It is not obligatory for both parties communicating over UDP to use the UDP Connection Factory Service. As the UDP Connection Factory Service implementation simply cares to open standard UDP sockets, connection-requester applications can communicate with any UDP socket opened on the specified host.
Note: If the connection factory is unregistered, all created connections are closed.
All URIs processed by the UDP connection factory must start with "datagram://". There are two types of URIs: for sending and for receiving.
datagram://<dest_host>:<port>[;<param>=<value>;<param>=<value>...]
where <dest_host> stands for the default destination host for sending the datagram packets. <port> stands for the port on which the UDP server receiving the datagrams is listening. Note that the local port for sending the datagrams is not specified in the sending type of URI. The [..] brackets show an optional part, they are not part of the URI itself. They show that the datagram URI can optionally have one or more parameters separated by semi-colon. <param> is the name of the parameter, <value> is its value. Parameters are listed in Table 1.
For example, a valid sending URI may look like this:
datagram://remote.psb:3333Or the same URI with parameters:
datagram://remote.psb:3333;maxLength=1024;timeout=30000
datagram://:<local_port>[;<param>=<value>;<param>=<value>...]
<local_port> indicates the local port for sending (and receiving) packets. The optional parameters that can be passed to this URI are the same as the parameters for receiving connections. See Table 1.
|
Note: Some parts of the URI are case sensitive! For details, refer to RFC 2396.
The Dictionary created by each connection contains the following
list of properties:
|
The UDP connection factory keeps all opened connections in a Dictionary.
If the service gets unregistered, all connections are closed.
If you want to use the UDP Connection Factory Service as an underlying transport
implementation for your connections, you must invoke the OSGi Connector Service,
exported by the Connector Service Bundle, and pass a datagram URI to
its open method. For more information refer to the Connector
Service Bundle description. You can manage the created connections using
the methods of the DatagramConnection and ConnectionNotifier
subinterfaces of javax.microedition.io.Connection, and their connection
properties using the values stored in the connection Dictionary.
The UDP Connection Bundle owns two user-definable system properties. They serve for debug purposes.
|
If you set/change these properties after the bundle has been activated, you must restart it so that it will accept the new values.