I am having an UDP Netty based server. It has a SimpleChannelUpstreamHandler
pipelined where I override the messageReceived
method.
I need to write back some information now and then. I could only do that by using the socket information from MessageEvent.getRemoteAddress()
, and the channel from MessageEvent.getChannel()
. In order to be able to reuse this information I keep in in a static map.
This turns into MessageEvent.getChannel().write("foo", MessageEvent.getRemoteAddress());
What I would have expected was to have MessageEvent.getChannel().getRemoteAddress()
work, which is not the case. It always gives me null
.
- Am I doing something wrong ?
- Is there a better way for writing back than keeping the channel and remote address in some member ?