org.jgroups.protocols
Class UDP
public
class
UDP
extends TP
implements Runnable
IP multicast transport based on UDP. Messages to the group (msg.dest == null) will
be multicast (to all group members), whereas point-to-point messages
(msg.dest != null) will be unicast to a single member. Uses a multicast and
a unicast socket.
The following properties are read by the UDP protocol:
- param mcast_addr - the multicast address to use; default is 228.8.8.8.
- param mcast_port - (int) the port that the multicast is sent on; default is 7600
- param ip_mcast - (boolean) flag whether to use IP multicast; default is true.
- param ip_ttl - the default time-to-live for multicast packets sent out on this
socket; default is 32.
- param use_packet_handler - boolean, defaults to false.
If set, the mcast and ucast receiver threads just put
the datagram's payload (a byte buffer) into a queue, from where a separate thread
will dequeue and handle them (unmarshal and pass up). This frees the receiver
threads from having to do message unmarshalling; this time can now be spent
receiving packets. If you have lots of retransmissions because of network
input buffer overflow, consider setting this property to true.
Author: Bela Ban
Constructor Summary |
| UDP()
Creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads. |
Method Summary |
String | getInfo() |
String | getName() |
protected void | handleConfigEvent(HashMap map) |
void | postUnmarshalling(Message msg, Address dest, Address src, boolean multicast) |
void | postUnmarshallingList(Message msg, Address dest, boolean multicast) |
void | run() |
void | sendToAllMembers(byte[] data, int offset, int length) |
void | sendToSingleMember(Address dest, byte[] data, int offset, int length) |
boolean | setProperties(Properties props)
Setup the Protocol instance acording to the configuration string.
|
void | start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads |
void | stop() |
public UDP()
Creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads.
public String getInfo()
public String getName()
protected void handleConfigEvent(HashMap map)
public void postUnmarshallingList(
Message msg,
Address dest, boolean multicast)
public void run()
public void sendToAllMembers(byte[] data, int offset, int length)
public void sendToSingleMember(
Address dest, byte[] data, int offset, int length)
public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string.
The following properties are read by the UDP protocol:
- param mcast_addr - the multicast address to use default is 228.8.8.8
- param mcast_port - (int) the port that the multicast is sent on default is 7600
- param ip_mcast - (boolean) flag whether to use IP multicast - default is true
- param ip_ttl - Set the default time-to-live for multicast packets sent out on this socket. default is 32
Returns: true if no other properties are left.
false if the properties still have data in them, ie ,
properties are left over and not handled by the protocol stack
public void start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
public void stop()
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.