org.jgroups.protocols

Class UDP1_4.ConnectorTable

Enclosing Class:
UDP1_4
Implemented Interfaces:
org.jgroups.protocols.Receiver, Runnable

public static class UDP1_4.ConnectorTable
extends java.lang.Object
implements org.jgroups.protocols.Receiver, Runnable

Manages a bunch of Connectors

Constructor Summary

ConnectorTable(InetSocketAddress mcast_addr, int receive_buffer_size, int receive_sock_buf_size, boolean ip_mcast, org.jgroups.protocols.Receiver receiver)

Method Summary

List
getConnectorAddresses()
Returns a list of local addresses (one for each Connector)
org.jgroups.protocols.Receiver
getReceiver()
void
listenOn(String bind_interface, int local_port, int port_range, int receive_buffer_size, int receiver_sock_buf_size, int send_sock_buf_size, int ip_ttl, org.jgroups.protocols.Receiver receiver)
Adds the given interface address to the list of interfaces on which the receiver mcast socket has to listen.
void
receive(DatagramPacket packet)
static void
receivePacket(DatagramPacket packet, DatagramSocket sock, org.jgroups.protocols.Receiver receiver)
void
run()
void
send(DatagramPacket msg)
Sends a packet.
void
setReceiver(org.jgroups.protocols.Receiver receiver)
void
start()
Get all interfaces, create one Connector per interface and call start() on it
void
stop()
String
toString()

Constructor Details

ConnectorTable

public ConnectorTable(InetSocketAddress mcast_addr,
                      int receive_buffer_size,
                      int receive_sock_buf_size,
                      boolean ip_mcast,
                      org.jgroups.protocols.Receiver receiver)
            throws IOException

Method Details

getConnectorAddresses

public List getConnectorAddresses()
Returns a list of local addresses (one for each Connector)
Returns:
List

getReceiver

public org.jgroups.protocols.Receiver getReceiver()

listenOn

public void listenOn(String bind_interface,
                     int local_port,
                     int port_range,
                     int receive_buffer_size,
                     int receiver_sock_buf_size,
                     int send_sock_buf_size,
                     int ip_ttl,
                     org.jgroups.protocols.Receiver receiver)
            throws IOException
Adds the given interface address to the list of interfaces on which the receiver mcast socket has to listen. Also creates a new Connector. Calling this method twice on the same interface will throw an exception
Parameters:
bind_interface -
local_port -
port_range -
receive_buffer_size -

receive

public void receive(DatagramPacket packet)
Specified by:
receive in interface org.jgroups.protocols.Receiver

receivePacket

public static void receivePacket(DatagramPacket packet,
                                 DatagramSocket sock,
                                 org.jgroups.protocols.Receiver receiver)
            throws IOException

run

public void run()

send

public void send(DatagramPacket msg)
            throws Exception
Sends a packet. If the destination is a multicast address, call send() on all connectors. If destination is not null, send the message using any Connector: if we send a unicast message, it doesn't matter to which interface we are bound; the kernel will choose the correct interface based on the destination and the routing table. Note that the receiver will have the interface which was chosen by the kernel to send the message as the receiver's address, so the correct Connector will receive a possible response.
Parameters:
msg -

setReceiver

public void setReceiver(org.jgroups.protocols.Receiver receiver)

start

public void start()
            throws Exception
Get all interfaces, create one Connector per interface and call start() on it

stop

public void stop()

toString

public String toString()

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.