[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
RE: xAP Development
- Subject: RE: xAP Development
- From: "Patrick Lidstone \(Personal E-mail\)" <patrick@xxxxxxxxxxxx>
- Date: Thu, 27 Oct 2005 06:51:47 +0100
> >3. Is there any more information specific to the development of
hub
> >applications?
>
Not completely clear on what the question is. Do you want to know how an
app
communicates/negotiates with a hub and what a hub actually does?
If so here goes (and if not, apologies):
When a xAPp starts, it can tell whether a hub is active by attempting to
bind UDP port 3639. If that port is in use, then you can assume that a hub
is already active.
If a hub is active, the xApp identifies a free ephemeral port (a port that
is not in use above, say, 10000). Once a free port has been identified, the
xAPp sends a heartbeat message to the broadcast address on the xAP base
port
number, 3639, which includes the loopback port number.
The message would have the following schema for device configured with the
logical name acme.cid.home.line1 where the first available port was 3640.
(ie. there are no other devices using this hub).
xap-hbeat
{
v=12
hop=1
uid=<uid>
class=xap-hbeat.alive
source=acme.cid.home.line1
interval=60
port=3640
}
Subsequently, the xAPp will send all outgoing messages to the host-ip
broadcast address on the xAP base port number. The xAPp will receive
incoming messages via the hub, on the chosen loopback port number.
The software hub, which is located on the same host as the client xAPp,
behaves as follows:
On startup, it opens a listener on the primary network interface, xAP base
port number 3639, and opens an outbound socket on the loopback interface.
Any incoming heartbeat on the primary interface is decoded, and the
originating ip address is validated. If the heartbeat originates from the
same host as the hub, the port value is added to a list. The heartbeat is
forwarded to all applications connected to the hub. Any incoming message
received on the primary network interface which is not a locally generated
heartbeat is forwarded to all hub-ports on the list via the loopback
interface. If no heartbeat is received from a given xAPp for two heartbeat
intervals, then the hub-port is removed from the list.
In choosing the heartbeat interval for a xAPp, bear in mind that the
recovery time for the xAPp, should the hub restart, will be, on average,
the
same as the heartbeat interval. Recovery following restart of a hub is
automatic, and a xAPp need take no specific corrective action. If required
a
xAPp may detect loss of connection with the local hub by listening for
echoes of it's own heartbeat (on the loopback port). Failure to receive the
heartbeat indicates a defective or non-existent hub.
HTH
Patrick
xAP_Development Main Index |
xAP_Development Thread Index |
xAP_Development Home |
Archives Home
|