netP5
Class AbstractMulticast

java.lang.Object
  extended by netP5.AbstractMulticast
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
Multicast

public abstract class AbstractMulticast
extends Object
implements Runnable


Constructor Summary
AbstractMulticast(UdpPacketListener theDatagramListener, String theMulticastAddress, int thePort)
           
AbstractMulticast(UdpPacketListener theDatagramListener, String theMulticastAddress, int thePort, int theBufferSize)
           
 
Method Summary
 void close()
           
 void dispose()
          dispose the multicastSocket.
 boolean loopback()
          get the current loopback mode.
 void run()
           
 void send(byte[] theBytes)
          send a byte array to the mulitcast address.
 void send(String theString)
          send a string to the multicast address.
 void setDatagramSize(int theDatagramSize)
          set the buffer size of the datagrams received by the multicast socket.
 void setLoopback(boolean theFlag)
          Disable/Enable local loopback of multicast datagrams.
 boolean setTimeToLive(int theTTL)
          Set the default time-to-live for multicast packets sent out on this MulticastSocket in order to control the scope of the multicasts.
 MulticastSocket socket()
          get the running multicast socket.
 void start()
           
 int timeToLive()
          get the current time to live value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMulticast

public AbstractMulticast(UdpPacketListener theDatagramListener,
                         String theMulticastAddress,
                         int thePort,
                         int theBufferSize)
Parameters:
theDatagramListener - UdpPacketListener
theMulticastAddress - String
thePort - int
theBufferSize - int

AbstractMulticast

public AbstractMulticast(UdpPacketListener theDatagramListener,
                         String theMulticastAddress,
                         int thePort)
Parameters:
theDatagramListener - UdpPacketListener
theMulticastAddress - String
thePort - int
Method Detail

socket

public MulticastSocket socket()
get the running multicast socket.

Returns:
MulticastSocket

setDatagramSize

public void setDatagramSize(int theDatagramSize)
set the buffer size of the datagrams received by the multicast socket.

Parameters:
theDatagramSize - int

start

public void start()

run

public void run()
Specified by:
run in interface Runnable

dispose

public void dispose()
dispose the multicastSocket.


close

public void close()

setTimeToLive

public boolean setTimeToLive(int theTTL)
Set the default time-to-live for multicast packets sent out on this MulticastSocket in order to control the scope of the multicasts. theTTL must be in the range 0 <= ttl <= 255

Parameters:
theTTL - int
Returns:
boolean

timeToLive

public int timeToLive()
get the current time to live value.

Returns:
int

setLoopback

public void setLoopback(boolean theFlag)
Disable/Enable local loopback of multicast datagrams. The option is used by the platform's networking code as a hint for setting whether multicast data will be looped back to the local socket.

Parameters:
theFlag - boolean

loopback

public boolean loopback()
get the current loopback mode. messages loop back to the local address if the loopback is set to false. set loopback to false to prevent messages to loop back to your local address.

Returns:
boolean

send

public void send(String theString)
send a string to the multicast address.

Parameters:
theString - String

send

public void send(byte[] theBytes)
send a byte array to the mulitcast address.

Parameters:
theBytes - byte[]


processing library oscP5 by Andreas Schlegel. (c) 2004-2012