Skip to content

SimpleChannelInboundHandler<DatagramPacket> added in the pipeline does not work #11

@arunp1990

Description

@arunp1990

There is a requirement in my project to obtain Host Address of the sender from the UDP Header for processing the request. As per my understanding, I need to add a handler using which I will get DatagramPacket. So, I modified the usage example given in https://github.com/Shevchik/UdpServerSocketChannel by replacing:
private static class Echo extends SimpleChannelInboundHandler
with
public static class Echo extends SimpleChannelInboundHandler.

The modified example is attached.

But, protected void channelRead0(ChannelHandlerContext channelHandlerContext, DatagramPacket datagramPacket) throws Exception is not invoked at all. It may be because the library (UdpServerSocketChannel) already has a similar handler

:
protected class ReadRouteChannelHandler extends SimpleChannelInboundHandler {

Can you please let me know if the above solution which I am trying can be made to work? If not, please let me know any alternate solution which I can try.

Thanks!

ExampleUdpServer.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions