SK.gnome.dwarf.tcpip
Class MulticastUDPListener

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.thread.ThreadService
          extended bySK.gnome.dwarf.tcpip.Listener
              extended bySK.gnome.dwarf.tcpip.UDPListener
                  extended bySK.gnome.dwarf.tcpip.MulticastUDPListener
All Implemented Interfaces:
java.lang.Runnable, Service

public class MulticastUDPListener
extends UDPListener

Service for receiving multicast client datagrams.

It listenes on a specified port and address and passes the received datagrams to TCPIPServer for further processing.

This listener overrides the getDatagramSocket() method to return the java.net.MulticastSocket instances.

The setGroups(String) method may be used to set the initial multicast groups the listener will listen to.


Field Summary
protected  java.util.Set groups
          The initial multicast groups.
protected  java.net.InetAddress iface
          The interface to listen on.
 
Fields inherited from class SK.gnome.dwarf.tcpip.UDPListener
connectAddress, connectPort, packetSize, socket
 
Fields inherited from class SK.gnome.dwarf.tcpip.Listener
address, allowedHosts, deniedHosts, port
 
Fields inherited from class SK.gnome.dwarf.thread.ThreadService
daemon, thread
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
MulticastUDPListener(java.lang.String name)
          Creates a new MulticastUDPListener.
 
Method Summary
protected  java.net.DatagramSocket getDatagramSocket()
          Returns the datagram socket.
 void setGroups(java.lang.String groups)
          Sets the initial multicast groups.
 void setInterface(java.net.InetAddress iface)
          Sets the interface to listen on.
 
Methods inherited from class SK.gnome.dwarf.tcpip.UDPListener
enableThread, finish, getDatagramPacket, init, loop, setConnectAddress, setConnectPort, setPacketSize
 
Methods inherited from class SK.gnome.dwarf.tcpip.Listener
acceptHost, setAddress, setAllowedHosts, setDeniedHosts, setPort
 
Methods inherited from class SK.gnome.dwarf.thread.ThreadService
run, setDaemon, shutdown, start, stop
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

iface

protected java.net.InetAddress iface
The interface to listen on.

See Also:
setInterface(InetAddress)

groups

protected java.util.Set groups
The initial multicast groups.

The set elements are of type java.net.InetAddress.

See Also:
setGroups(String)
Constructor Detail

MulticastUDPListener

public MulticastUDPListener(java.lang.String name)
Creates a new MulticastUDPListener.

Method Detail

setInterface

public void setInterface(java.net.InetAddress iface)
Sets the interface to listen on.

Parameters:
iface - the interface
See Also:
iface

setGroups

public void setGroups(java.lang.String groups)
               throws java.net.UnknownHostException
Sets the initial multicast groups.

A comma-separated list of either multicast hostnames or multicast IP addresses must be specified.

Parameters:
groups - the comma-separated list of hosts
Throws:
java.net.UnknownHostException - if the internet host is not found
java.lang.IllegalArgumentException - if a specified address is not multicast
See Also:
groups

getDatagramSocket

protected java.net.DatagramSocket getDatagramSocket()
                                             throws ServiceException
Returns the datagram socket.

Returns the java.net.MulticastSocket for listening. The returned socket will be bound to the Listener.port. If the iface field is null, the socket will use all available interfaces, otherwise it will use just the specified interface. If groups contains any elements, the socket will join the specified groups before returned from this method.

Overrides:
getDatagramSocket in class UDPListener
Throws:
ServiceException


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.