public interface SocketListener
AsyncSocket
or
AsyncSecureSocket
to which the implementing object is
registered. Also is informed if the socket unexpectedly
closes.AsyncSocket
,
AsyncSecureSocket
Modifier and Type | Method and Description |
---|---|
void |
handleClose(java.lang.Throwable t,
AbstractAsyncSocket socket)
Reports the
AsyncSocket is now closed. |
void |
handleInput(java.nio.ByteBuffer buffer,
AbstractAsyncSocket socket)
Reports input received on the socket.
|
void |
handleOpen(AbstractAsyncSocket socket)
Reports that the socket is connected to the remote end.
|
void |
handleOutputAvailable(AbstractAsyncSocket socket)
Reports that
socket 's output buffer is no longer
full and the listener may again call
AsyncSocket.send(int) methods. |
void handleOpen(AbstractAsyncSocket socket)
open
returned false
. If open
returned
true
, then the connection was completed by
open
. If the connect attempt failed, then
handleClose
is called instead.socket
- now connected socket.AsyncSocket.open(java.net.SocketAddress)
,
handleClose(java.lang.Throwable, net.sf.eBus.net.AbstractAsyncSocket)
void handleInput(java.nio.ByteBuffer buffer, AbstractAsyncSocket socket)
Buffer.remaining()
is
the number of valid bytes in buffer
.
If the listener needs to reference input
's
contents after returning, then the listener must store the
desired bytes to a new location prior to returning.
Do not flip or compact buffer
.
This is automatically performed by AsyncSocket
upon return.
buffer
- buffer containing bytes read from the
socket.socket
- input
bytes read from this
AsyncSocket
object.void handleOutputAvailable(AbstractAsyncSocket socket)
socket
's output buffer is no longer
full and the listener may again call
AsyncSocket.send(int)
methods. This method is called
only after a send
method threw a
overflow exception
.socket
- this socket output buffer is no longer
full.AsyncSocket.send(BufferWriter)
void handleClose(java.lang.Throwable t, AbstractAsyncSocket socket)
AsyncSocket
is now closed. If the
socket closed due to an exception, the exception is
forwarded in t
.t
- the caught Throwable
. May be
null
.socket
- the now closed AsyncSocket
.AsyncSocket.close(boolean)
,
AbstractAsyncSocket.closeNow()
Copyright © 2001 - 2024. Charles W. Rapp. All rights reserved.