next up previous contents
Next: View Up: Channel and related classes Previous: Address   Contents


Message

Data is sent between members in the form of messages (Message). A message can be sent by a member to a single member, or to all members of the group of which the channel is an endpoint. The structure of a message is shown in fig. 3.1.

Figure 3.1: Structure of a message
\begin{figure}\center{\epsfig{file=figs/Message.eps,width=.55\textwidth}}
\end{figure}

A message is similar to an IP packet and consists of the payload (a byte buffer) and the addresses of the sender and receiver (as Addresses). Any message put on the network can be routed to its destination (receiver address), and replies can be returned to the sender's address.

A message usually does not need to fill in the sender's address when sending a message; this is done automatically by the protocol stack before a message is put on the network. However, there may be cases, when the sender of a message wants to give an address different from its own, so that for example, a response should be returned to some other member.

The destination address (receiver) can be an Address, denoting the address of a member, determined e.g. from a message received previously, or it can be null, which means that the message will be sent to all members of the group. A typical multicast message, sending string "Hello" to all members would look like this:

  Message msg=new Message(null, null, "Hello".getBytes());
  channel.send(msg);


next up previous contents
Next: View Up: Channel and related classes Previous: Address   Contents
Bela Ban 2002-11-16