Interface ASyncUDPListener

All Superinterfaces:

public interface ASyncUDPListener
extends ASyncListener

A callback interface allowing a client of this ASyncUDP instance to be notified of when data is received from remote hosts.

Michael Parker

Method Summary
 boolean newDataReceived(AddressPortPair app, java.nio.ByteBuffer data, ProcessReadyCallback prc)
          This callback method is invoked when data is received from a remote host.
Methods inherited from interface async.common.ASyncListener
nowRunning, providerStopped, serviceStopped

Method Detail


boolean newDataReceived(AddressPortPair app,
                        java.nio.ByteBuffer data,
                        ProcessReadyCallback prc)
This callback method is invoked when data is received from a remote host. If the implementor of this callback is ready to empty the buffer immediately, then it should do so and return true. Note that after the client empties the buffer, its compact method should not be invoked. Additionally, if this method returns true but removes nothing from the buffer, then its contents are simply discarded. Otherwise, if the implementor is not ready to empty the buffer immediately, it should return false and keep a reference to the provided ProcessReadyCallback argument. When method nowReady is invoked on this object, then the ASyncUDP instance will invoke this method again. Note that because ASyncUDP does not employ flow control, while it is waiting for the client to process bb, new data may be arriving from the remote host. If the amount that arrives is greater than the underlying datagram buffer, received data may be lost.

app - the address and port from which the data was received
data - a ByteBuffer containing the received data
prc - the object through which the client later notifies the ASyncUDP instance that it is ready to drain bb if this method returns false
true if the client was ready to empty the buffer, false otherwise