Hi Norman,
Apologies for not getting back to you sooner. My initial attempt at this
had a bug in it. I had the encoders in the wrong order. I ended up with
something like this:
ChannelInitializer<DatagramChannel> datagramChannelInitializer = new
ChannelInitializer<DatagramChannel>() {
@Override
public void initChannel(DatagramChannel ch) throws
Exception {
ch.pipeline().addLast(new
DatagramPacketDecoder(new Type1Decoder()))
.addLast(new Type2MessageToMessageDecoder())
.addLast(new DatagramPacketEncoder<>(new Type1Encoder())
.addLast(new Type2MessageToMessageEncoder())
);
}
}
On Thursday, 4 August 2016 14:13:19 UTC+1, Norman Maurer wrote:
>
> Can you show me the code that not worked ?
>
>
> On 02 Aug 2016, at 15:06, [email protected] <javascript:> wrote:
>
> Hi,
>
> I'd like to use a MessageToMessageDecoder to transform from one type to
> another while sending a message from a client to a remote server. The
> MessageToMessage Encoder/Decoder allow this to be accomplished easily.
> When using UDP and an AddressedEnvelope to preserve remote address info,
> this is not the case.
>
> The following snippet shows a simplified channel pipeline to hopefully
> illustrate my use case.
>
> ChannelInitializer<DatagramChannel> datagramChannelInitializer = new
> ChannelInitializer<DatagramChannel>() {
> @Override
> public void initChannel(DatagramChannel ch) throws
> Exception {
>
> ch.pipeline().addLast(new
> DatagramPacketDecoder(new Type1Decoder()))
> .addLast(new
> Type2MessageToMessageDecoder())
>
>
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/78f3bafd-ba4b-4b97-8cea-0725e89a3c6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.