Connecting two server channels efficiently
beric
ericbouer at gmail.com
Wed Apr 28 17:09:51 EDT 2010
Hello list of a very nice project.
I'm trying to bridge two listening sockets so that any data on each of them
will reach the other. the UNIX way is: "cat fifo | nc -l -p 3344 | nc -l -p
3355 > fifo" Now help me figure the Netty way :)
My current way of doing that is by having 2 ServerBootstrap, while one of
them(foo) has a SimpleChannelUpstreamHandler that has access to the pipeline
of the other ServerBootstrap(bar) by holding a ChannelPiple member.
Then, in channelOpen I'm trying to add an OutboundHAndler(from HexDumpProxy)
to the channelpipeline of bar.
It looks like this:
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
//Suspend incoming traffic
final Channel inboundChannel = e.getChannel();
inboundChannel.setReadable(false);
this.sb2piChannelPipeline.addLast("handler-sb2", new
OutboundHandler(e.getChannel()));
}
However I get a IllegalArgumentException : Duplicate handler name.
I guess I did something wrong. I would like to know why, or any (probably
better) alternative implementation of what I'm trying to do here.
Thanks.
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Connecting-two-server-channels-efficiently-tp4976904p4976904.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list