netP5
Class UdpServer

java.lang.Object
  extended by netP5.AbstractUdpServer
      extended by netP5.UdpServer
All Implemented Interfaces:
Runnable, UdpPacketListener

public class UdpServer
extends AbstractUdpServer
implements UdpPacketListener

Author:
andreas schlegel

Constructor Summary
UdpServer(Object theObject, int thePort)
           
UdpServer(Object theObject, int thePort, int theBufferSize)
          new UDP server.
UdpServer(UdpPacketListener theListener, int thePort, int theBufferSize)
           
 
Method Summary
 void addListener(NetListener theListener)
          add a listener to the udp server.
 NetListener getListener(int theIndex)
           
 Vector getListeners()
           
 void process(DatagramPacket thePacket, int thePort)
           
 void removeListener(NetListener theListener)
           
 
Methods inherited from class netP5.AbstractUdpServer
dispose, run, send, send, send, send, socket, start
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpServer

public UdpServer(Object theObject,
                 int thePort,
                 int theBufferSize)
new UDP server. by default the buffersize of a udp packet is 1536 bytes. you can set your own individual buffersize with the third parameter int in the constructor.

Parameters:
theObject - Object
thePort - int
theBufferSize - int

UdpServer

public UdpServer(Object theObject,
                 int thePort)

UdpServer

public UdpServer(UdpPacketListener theListener,
                 int thePort,
                 int theBufferSize)
Parameters:
theListener -
thePort -
theBufferSize -
Method Detail

process

public void process(DatagramPacket thePacket,
                    int thePort)
Specified by:
process in interface UdpPacketListener
Parameters:
thePacket - DatagramPacket
thePort - int

addListener

public void addListener(NetListener theListener)
add a listener to the udp server. each incoming packet will be forwarded to the listener.

Parameters:
theListener -

removeListener

public void removeListener(NetListener theListener)
Parameters:
theListener -

getListener

public NetListener getListener(int theIndex)
Parameters:
theIndex -
Returns:

getListeners

public Vector getListeners()
Returns:


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