tomcat - Run Netty and tomcat on same port but different ip in a single server (Netty opens at localhost)
问题描述
Have a server with 2 IP address(suppose 1.1.1.a and 1.1.1.b) Trying to configure the jar that is using netty so that it creates the WebSocket at 443 port. The server also hosts a tomcat that uses 443. Now tried to configure the netty to 1.1.1.a:443 and tomcat to 1.1.1.b:443.
ServerBootstrap b = new ServerBootstrap();
b.option(ChannelOption.SO_BACKLOG, 1024);
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.localAddress(new InetSocketAddress("1.1.1.a", 443))
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new HTTPInitializer());
channel = b.bind(443).sync().channel();
But still, the netty is trying to start at 0.0.0.0:443 causing Bind Exception. Is it possible to configure in such a way? and if so what should be done?
解决方案
Sure ... just use bind(new InetSocketAddress("1.1.1.a",443)
推荐阅读
- javascript - nuxt-child 不渲染父组件
- android - Firebase Firestore 未连接
- python - XOAUTH2 Django 中的无效 SASL 参数
- ruby-on-rails - 如何使用动态绑定编写 Rails ActiveRecord 更新查询?
- asp.net-mvc - 如何使用来自 ASP.NET MVC 视图的@Input 将 JSON 数组传递给 Angular2 模板?
- angularjs - 来自服务的Angularjs绑定值
- python - Keras LSTM 输入 - ValueError:检查输入时出错:预期 input_1 具有 3 个维度,但得到的数组具有形状 (1745, 1)
- python - Python pandas 设置 NaN 值失败
- tomcat7 - Ubuntu VM CPU 过载
- arrays - 是否可以在 PowerShell 中使 IndexOf 不区分大小写?