Peer Information Protocol

Once a peer is located, its capabilities and status may be queried. The PIP provides a generic framework for obtaining peer status and monitoring information. Peers are not required to respond to PIP requests. A reliable transport is optional.

Multiple peer information messages may be sent. Zero, one, or multiple responses may be received in response to a peer information query. The PIP is layered on the PRP. A QueryID field is used for matching PIP queries to the PIP responses.

Obtaining PIP Responses

The PIP query message provides a request field that may be used to encode a specific request. The PIP does not dictate the format of the request field. Higher-level services could utilize the request field for adding expanded capabilities.

The PIP is composed of a query message, which is sent to query a peer for its current state and other relevant information (see Example 17-6). A query without a defined request field returns a default set of information about a peer (i.e., uptime, message count, etc.).

Example 17-6. Query message schema

<xs:element name="PeerInfoQueryMessage" 
            type="jxta:PeerInfoQueryMessage"/>

<xs:complexType name="PeerInfoQueryMessage">     
   <xs:element name="sourcePid" type="xs:anyURI"/>     
   <xs:element name="targetPid" type="xs:anyURI"/>     
   <xs:element name="request" type="xs:anyType" minOccurs="0"/> </xs:complexType>

The elements in Example 17-6 are:

sourcePid

The source peer ID of the requesting peer

targetPid

The destination peer ID ...

Get JXTA in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.