【文章內(nèi)容簡介】
wards formatted applicationlayer messages in the overlay work. The forwarding engine municates with the overlay node to query next hop routing information for application messages. The forwarding decision is made using logical addresses of the overlay nodes. Each overlay socket has two work adapters that each provides an interface to transportlayer protocols, such as TCP or UDP. The node 專業(yè)外文翻譯 7 adapter serves as the interface for sending and receiving overlay protocol messages, and the socket adapter serves as the interface for application messages. Each adapter has a transport level address, which, in the case of the Inter, consists of an IP address and a UDP or TCP port number. Currently, there are three different types of adapters, for TCP, UDP, and UDP multicast. Using two adapters pletely separates the handling of messages for maintaining the overlay protocol and the messages that transport application data. The application receive buffer and application transmit buffer can temporarily store messages that, respectively, have been received by the socket but not been delivered to theapplication, or that have been released by the application program, but not been transmitted by the socket. The application transmit buffer can play a role when messages cannot be transmitted due to rate control or congestion control constraints. The application transmit buffer is not implemented in the HyperCast overlay socket has two external interfaces. The application programming interface (API) of the socket offers application programs the ability to join and leave existing overlays, to send data to other members of the overlay work, and receive data from the overlay work. The statistics interface of the overlay socket provides access to status information of ponents of the overlay socket, and is used for monitoring and management of an overlay socket. Note in Figure 3 that some ponents of the overlay socket also have interfaces, which are accessed by other ponents of the overlay socket. The overlay manager is a ponent external to the overlay socket (and not shown in Figure 3). It is responsible for configuring an overlay socket when the socket is created. The overlay manager reads a configuration file that stores the attributes of an overlay socket, and, if it is specified in the configuration file, may access attributes from a server, and then initiates the instantiation of a new overlay socket. 4 Overlay Network Programming An application developer does not need to be familiar with the details of the ponents of an overlay socket as described in the previous section. The developer is exposed only to the API of the overlay socket and to a file with configuration parameters. 專業(yè)外文翻譯 8 The configuration file is a text file which stores all attributes needed to configure an overlay socket. The configuration file is modified whenever a change is needed to the transport protocol, the overlay protocol, or some other parameters of the overlay socket. In the following, we summarize only the main features of the API, and we refer to [12] for detailed information on the overlay socket API. Overlay Socket API Since the overlay topology and the forwarding of applicationlayer data is 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()。 String MyOverlay = (OverlayID)。 OverlaySocketConfig config = new (MyOverlay)。 // create an overlay socket OL Socket socket = (callback)。 // Join an overlay 專業(yè)外文翻譯 9 ()。 // Create a message OL Message msg = (byte[] data, int length)。 // Send the message to all members in overlay work (msg)。 // Receive a message from the socket OL Message msg = ()。 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