org.jgroups.protocols
Class UDP_NIO.Connector

java.lang.Object
  extended byorg.jgroups.protocols.UDP_NIO.Connector
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
UDP_NIO

public static class UDP_NIO.Connector
extends java.lang.Object
implements java.lang.Runnable

Manages a multicast and unicast socket on a given interface (NIC). The multicast socket is used to listen for incoming multicast packets, the unicast socket is used to (1) listen for incoming unicast packets, (2) to send unicast packets and (3) to send multicast packets


Field Summary
protected  byte[] receive_buffer
          Buffer for incoming unicast packets
protected  org.jgroups.protocols.UDP_NIO.Connector.SenderThread sender_thread
           
protected  java.lang.Thread t
           
 
Constructor Summary
UDP_NIO.Connector(java.net.NetworkInterface bind_interface, int local_bind_port, int port_range, int receive_buffer_size, int receive_sock_buf_size, int send_sock_buf_size, int ip_ttl, org.jgroups.protocols.Receiver receiver)
           
 
Method Summary
 java.net.NetworkInterface getBindInterface()
           
 java.net.SocketAddress getLocalAddress()
           
 void run()
           
 void send(java.net.DatagramPacket packet)
          Sends a message using mcast_sock
 void start()
           
 void stop()
          Stops the connector.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

t

protected java.lang.Thread t

sender_thread

protected org.jgroups.protocols.UDP_NIO.Connector.SenderThread sender_thread

receive_buffer

protected byte[] receive_buffer
Buffer for incoming unicast packets

Constructor Detail

UDP_NIO.Connector

public UDP_NIO.Connector(java.net.NetworkInterface bind_interface,
                         int local_bind_port,
                         int port_range,
                         int receive_buffer_size,
                         int receive_sock_buf_size,
                         int send_sock_buf_size,
                         int ip_ttl,
                         org.jgroups.protocols.Receiver receiver)
                  throws java.io.IOException
Method Detail

getLocalAddress

public java.net.SocketAddress getLocalAddress()

getBindInterface

public java.net.NetworkInterface getBindInterface()

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

stop

public void stop()
Stops the connector. After this call, start() cannot be called, but a new connector has to be created


send

public void send(java.net.DatagramPacket packet)
          throws java.lang.Exception
Sends a message using mcast_sock

Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable

toString

public java.lang.String toString()


Copyright ? 1998-2005 Bela Ban. All Rights Reserved.