【正文】
transparent to the application program, the API for overlay work programming can be made simple. Applications need to be able to create a new overlay work, join and leave an existing overlay work, send data to and receive data from other members in the overlay. The API of the overlay socket is messagebased, and intentionally stays close to the familiar Berkeley socket API [3]. Since space considerations do not permit a description of the full API, we sketch the API with the help of a simplified example. Figure 4 shows the fragment of a Java program that uses an overlay socket. An application program configures and creates an overlay socket with the help of an overlay manager (o m). The overlay manager reads configuration parameters for the overlay socket from a configuration file ( p), which can look similarly as shown in Figure 5. The application program reads the overlay ID with mand (“OverlayID”) from the file, and creates an configuration object (confi g) for an overlay socket with the. // Generate the configuration object OverlayManager om = new OverlayManager()。 // Join an overlay 專業(yè)外文翻譯 9 ()。 Fig. 4. Program with overlay sockets. OVERLAY Server: OverlayServer = OVERLAY ID: OverlayID = 1234 KeyAttributes= Socket,Node,SocketAdapter SOCKET: Socket = HCast20 = 255 = 200 SOCKET ADAPTER: SocketAdapter = TCP = 16384 NODE: Node = DT20 = 400 NODE ADAPTER: NodeAdapter = NodeAdptUDPServer = 8192 = :8081 Fig. 5. Configuration file (simplified) given overlay ID. The configuration object 專業(yè)外文翻譯 10 also loads all configuration information from the configuration file, and then creates the overlay socket( OverlaySocke t). Once the overlay socket is created, the socket joins the overlay work ( p). When a socket wants to multicast a message, it instantiates a new message () and trans mits the message using the sendToAll method. Other transmission options are sendToParent, send ToChildren, sendToNeighbors, and sendToNode, which, respectively, send a message to the upstream neighbor with respect to a given root (see Figure 2), to the downstream neighbors, to all neighbors, or to a particular node with a given logical address. Overlay Network Properties Management As seen, the properties of an overlay socket are configured by setting attributes in a configuration file. The overlay manager in an application process uses the attributes to create a new overlay socket. By modifying the attributes in the configuration file, an application programmer can configure the overlay protocol or transport protocol that is used by the overlay socket. Changes to the file must be done before the socket is created. Figure 5 shows a (simplified) example of a configuration file. Each line of the configuration file assigns a value to an attribute. The plete list of attributes and the range of values is documented in [12]. Without explaining all entries in Figure 5, the file sets, among others, the overlay ID to ?1234 ?, selects version of the DT protocol as overlay protocol (?Node= DT20 ?), and it sets the transport protocol of the socket adaptor to TCP(?SocketAdapter=TCP ?). Each overlay work is associated with a set of attributes that characterize the properties of the over lay sockets that participate in the overlay work. As mentioned earlier, the most important attribute is the overlay ID, which is used to identify an work, and 專業(yè)外文翻譯 11 which can be used as a key to access all other attributes of an overlay work. The overlay ID should be a globally unique identifier. A new overlay work is created by generating a new overlay ID and associating a set of attributes that specify the properties of the overlay sockets in the overlay work. To join an overlay work, an overlay socket must know the overlay ID and the set of attributes for this overlay ID. This information can be obtained from a configuration file, as shown in Figure 5. All attributes have a name and a value, both of which are strings. For example, the overlay protocol of an overlay socket can be determined by an attribute with name NODE. If the attribute is set to NOD E=DT2 0, then the overlay node in the overlay socket runs the DT (version 2) overlay protocol. The overlay socket distinguishes between two types of attributes: key attributes and configurable attributes. Key attributes are specific to an overlay work with a given overlay ID. Key attributes are selected when the overlay ID is created for an overlay work, and cannot be modified afterwards. Overlay sockets that participate in an overlay work must have identical key attributes, but can have different configurable attributes. The attributes OverlayID and KeyAttributes are key attributes by default in all overlay works. Configurable attributes specify parameters of an overlay socket, which are not considered essential for establishing munication between overlay sockets in the same overlay work, and which are considered ?tunable?. 5 Conclusions We discussed the design of an overlay socket which attempts to simplify the task of overlay work programming. The overlay socket serves as an end point of munication in the overlay work. The overlay socket can be used for various overlay topologies and support different transport protoc ols. The overlay socket supports a simple API for joining and leaving an overlay 專業(yè)外文翻譯 12 work, and for sending and receiving data to and from other sockets in the overlay work. The main advantage of the overlay socket is that it is relatively easy to change the configuration of the overlay work.