简体   繁体   中英

How to put a netty client in a netty server

I want to create two netty servers. And the first server will need to request the second server. Is that means I have to put a netty client in the first server or is there a better way to fix it?

In your case you want the first server to act as a proxy server which effectively means the first server is a client to the second server. As the request arrives first server, you want to contact the second server send response back to the client through first server.

If so, yes you need to have netty client related code in the first server to talk to the second one.

You can refer to proxy server example provided by netty itself at Netty Proxy Server or http://www.mastertheboss.com/jboss-frameworks/netty/use-netty-to-proxy-your-requests

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM