public interface NetworkListener
Modifier and Type | Method and Description |
---|---|
void |
onClose(NetworkChannel channel)
Called when the network connection is closed at the remote end.
|
void |
onError(NetworkChannel channel,
Exception exception)
Called when an error occurs on the network connection - for example because
the process at the remote end of the connection abruptly ends.
|
void |
onRead(NetworkChannel channel,
io.netty.buffer.ByteBuf buffer)
Called when data is read from the network.
|
void onRead(NetworkChannel channel, io.netty.buffer.ByteBuf buffer)
channel
- identifies which network connection the data was
read from.buffer
- contains the data that has been read. The buffer belongs
to the implementation of this method - and will not be
altered by the implementation of NetworkService
once
this method has been invoked.
Once the buffer is finished with the ReferenceCounted.release()
method must be called to return the buffer to the pool, otherwise
a memory leak will eventually be reported by the
ResourceLeakDetector
.
void onClose(NetworkChannel channel)
channel
- identifies which network connections was closed.void onError(NetworkChannel channel, Exception exception)
channel
- identifies which network connection the error relates to.exception
- an exception relating to the error condition.Copyright © 2016 International Business Machines Corporation. All rights reserved.