Reputation: 169
I want to write a program in Netty4 that should act as a server to other clients and also it itself is a client to another server. How to do this in Netty4? So far all examples I have seen are either client or server. Thanks.
Upvotes: 0
Views: 155
Reputation: 242686
There are no special difficulties here. You need to create a part that will act as a server (using ServerBootstrap
), and a part that will act as a client (using Bootstrap
).
If you need to establish a connection to another server while handling incoming connection from a client, you can place that logic into a ChannelHandler
of the server's pipeline.
Netty provides two examples of this approach:
Upvotes: 1