com.jme3.network.kernel.udp
Class UdpKernel

java.lang.Object
  extended by com.jme3.network.kernel.AbstractKernel
      extended by com.jme3.network.kernel.udp.UdpKernel
All Implemented Interfaces:
Kernel

public class UdpKernel
extends AbstractKernel

A Kernel implementation using UDP packets.


Nested Class Summary
protected  class UdpKernel.HostThread
           
protected  class UdpKernel.MessageWriter
           
 
Field Summary
 
Fields inherited from interface com.jme3.network.kernel.Kernel
EVENTS_PENDING
 
Constructor Summary
UdpKernel(java.net.InetAddress host, int port)
           
UdpKernel(java.net.InetSocketAddress address)
           
UdpKernel(int port)
           
 
Method Summary
 void broadcast(Filter<? super Endpoint> filter, java.nio.ByteBuffer data, boolean reliable, boolean copy)
          Dispatches the data to all endpoints managed by the kernel.
protected  void closeEndpoint(UdpEndpoint p)
          Called by the endpoints when they need to be closed.
protected  UdpKernel.HostThread createHostThread()
           
protected  void enqueueWrite(Endpoint endpoint, java.net.DatagramPacket packet)
           
protected  Endpoint getEndpoint(java.net.SocketAddress address, boolean create)
           
 void initialize()
          Initializes the kernel and starts any internal processing.
protected  void newData(java.net.DatagramPacket packet)
           
 void terminate()
          Gracefully terminates the kernel and stops any internal daemon processing.
 
Methods inherited from class com.jme3.network.kernel.AbstractKernel
addEnvelope, addEvent, hasEnvelopes, nextEndpointId, nextEvent, read, reportError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpKernel

public UdpKernel(java.net.InetAddress host,
                 int port)

UdpKernel

public UdpKernel(int port)
          throws java.io.IOException
Throws:
java.io.IOException

UdpKernel

public UdpKernel(java.net.InetSocketAddress address)
Method Detail

createHostThread

protected UdpKernel.HostThread createHostThread()

initialize

public void initialize()
Description copied from interface: Kernel
Initializes the kernel and starts any internal processing.


terminate

public void terminate()
               throws java.lang.InterruptedException
Description copied from interface: Kernel
Gracefully terminates the kernel and stops any internal daemon processing. This method will not return until all internal threads have been shut down.

Throws:
java.lang.InterruptedException

broadcast

public void broadcast(Filter<? super Endpoint> filter,
                      java.nio.ByteBuffer data,
                      boolean reliable,
                      boolean copy)
Dispatches the data to all endpoints managed by the kernel. 'routing' is currently ignored.


getEndpoint

protected Endpoint getEndpoint(java.net.SocketAddress address,
                               boolean create)

closeEndpoint

protected void closeEndpoint(UdpEndpoint p)
                      throws java.io.IOException
Called by the endpoints when they need to be closed.

Throws:
java.io.IOException

newData

protected void newData(java.net.DatagramPacket packet)

enqueueWrite

protected void enqueueWrite(Endpoint endpoint,
                            java.net.DatagramPacket packet)