ist.palcom.mal
Class UDPMediaManager

java.lang.Object
  extended by ist.palcom.mal.MediaManager
      extended by ist.palcom.mal.UDPMediaManager

public class UDPMediaManager
extends MediaManager

This class implement is a media manager for UDP.

See Also:
MediaManager

Nested Class Summary
 
Nested classes/interfaces inherited from class ist.palcom.mal.MediaManager
MediaManager.BroadcastDistributor, MediaManager.DistributorThread, MediaManager.UnicastDistributor
 
Field Summary
 
Fields inherited from class ist.palcom.mal.MediaManager
distributorThread, PALCOM_URL_PREFIX, scheduler
 
Constructor Summary
UDPMediaManager(PalcomScheduler scheduler)
          Deprecated. See superclass
UDPMediaManager(PalcomScheduler scheduler, PalcomThread errorHandler)
           
 
Method Summary
 URL[] getDefaultGroupAddresses()
           
 int getDefaultReceiveBufferSize()
           
 int getDefaultSendBufferSize()
           
 URL getDefaultUnicastURL()
          Returns the URL that the manager listens for messages at by default.
protected  CommunicationThread getReceivingThread(URL url)
           
protected  CommunicationThread getSendingThread(URL url)
           
protected  boolean isBroadcast(URL url)
          This method is called isBroadcast, but in the case of UDP it actually checks if the address is a multicast address.
protected  void removeReceivingThread(URL url)
          Stop receiving at url, and remove the receiving thread.
 void setDefaultReceiveBufferSize(int size)
           
 void setDefaultSendBufferSize(int size)
           
 void stop()
          Stop the manager.
 
Methods inherited from class ist.palcom.mal.MediaManager
addErrorHandler, getHost, getPort, getProtocol, getProtocolSpecificUrl, getSelector, messageReceived, raiseErrorEvent, registerDeviceURL, send, send, sendBroadcast, startReceiving, startReceiving, startReceiving2, startReceivingBroadcast, stopReceiving, stopReceiving, stopReceiving, stopReceiving
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, println, toString
 

Constructor Detail

UDPMediaManager

public UDPMediaManager(PalcomScheduler scheduler)
Deprecated. See superclass


UDPMediaManager

public UDPMediaManager(PalcomScheduler scheduler,
                       PalcomThread errorHandler)
Method Detail

stop

public void stop()
Description copied from class: MediaManager
Stop the manager. This will stop all listening for messages.

Overrides:
stop in class MediaManager

getDefaultUnicastURL

public URL getDefaultUnicastURL()
Description copied from class: MediaManager
Returns the URL that the manager listens for messages at by default. This method has been made public so it can be used from test programs, but it is not otherwise used by classes other than MediaManager and its subclasses.

Specified by:
getDefaultUnicastURL in class MediaManager
Returns:
The default URL. This URL is listened on unless another URL is specified in a call to startReceiving(String, PalcomThread).

getReceivingThread

protected CommunicationThread getReceivingThread(URL url)
Specified by:
getReceivingThread in class MediaManager
Returns:
CommunicationThread for receiving at url. If it does not exist, a new one is created and returned.

removeReceivingThread

protected void removeReceivingThread(URL url)
Description copied from class: MediaManager
Stop receiving at url, and remove the receiving thread.

Specified by:
removeReceivingThread in class MediaManager

getSendingThread

protected CommunicationThread getSendingThread(URL url)
Specified by:
getSendingThread in class MediaManager
Returns:
A CommunicationThread that can be used for sending a message to the given URL.

isBroadcast

protected boolean isBroadcast(URL url)
This method is called isBroadcast, but in the case of UDP it actually checks if the address is a multicast address.

Specified by:
isBroadcast in class MediaManager
Returns:
true if the URL is a broadcast address (or multicast, depending on the protocol), false if not.

getDefaultGroupAddresses

public URL[] getDefaultGroupAddresses()
Specified by:
getDefaultGroupAddresses in class MediaManager
Returns:
The default broadcast addresses for group communication.

getDefaultReceiveBufferSize

public int getDefaultReceiveBufferSize()
Returns:
the default receive buffer size for UDP sockets, or zero if not set.

getDefaultSendBufferSize

public int getDefaultSendBufferSize()
Returns:
the default send buffer size for UDP sockets, or zero if not set.

setDefaultReceiveBufferSize

public void setDefaultReceiveBufferSize(int size)

setDefaultSendBufferSize

public void setDefaultSendBufferSize(int size)