Open B1gB1gRAin opened 4 years ago
Hi @B1gB1gRAin, we detect non-English characters in the issue. This comment is an auto translation by @sofastack-robot to help other users to understand this issue.
We encourage you to describe your issue in English which is more friendly to other users.
this.bootstrap = new ServerBootstrap(); this.bootstrap .group(bossGroup, workerGroup) .channel( NettyEventLoopUtil.getServerSocketChannelClass()) .option(ChannelOption.SO_BACKLOG, ConfigManager.tcp_so_backlog()) .option(ChannelOption.SO_REUSEADDR, ConfigManager.tcp_so_reuseaddr()) .childOption(ChannelOption.TCP_NODELAY, ConfigManager.tcp_nodelay()) .childOption SO_KEEPALIVE, ConfigManager.tcp_so_keepalive()) .childOption(ChannelOption.SO_SNDBUF, tcpSoSndBuf != null? TcpSoSndBuf: ConfigManager.tcp_so_sndbuf()) .childOption(ChannelOption.SO_RCVBUF, tcpSoRcvBuf !=v cpt = (?vt?)) / set write buffer water mark initWriteBufferWaterMark();
Thanks to the platform thanks to open source ### Your scenes udp message and tcp broadcast ### Your advice describe the advice or solution you'd like ### Environment- SOFABolt version:1.6.1-JVM version (eg java -version
):1.8-OS version (eg uname -a
):win7-Maven version:3.6-IDE version:ideaHow to create udp protocol?
this.bootstrap
.group(bossGroup, workerGroup)
.channel(NettyEventLoopUtil.getServerSocketChannelClass())
.option(ChannelOption.SO_BACKLOG, ConfigManager.tcp_so_backlog())
.option(ChannelOption.SO_REUSEADDR, ConfigManager.tcp_so_reuseaddr())
.childOption(ChannelOption.TCP_NODELAY, ConfigManager.tcp_nodelay())
.childOption(ChannelOption.SO_KEEPALIVE, ConfigManager.tcp_so_keepalive())
.childOption(ChannelOption.SO_SNDBUF,
tcpSoSndBuf != null ? tcpSoSndBuf : ConfigManager.tcp_so_sndbuf())
.childOption(ChannelOption.SO_RCVBUF,
tcpSoRcvBuf != null ? tcpSoRcvBuf : ConfigManager.tcp_so_rcvbuf());
// set write buffer water mark
initWriteBufferWaterMark();```
@xmtsui @zhaojigang @dbl-x
I don’t think it’s supported UDP yet,but you can Try like this:
BootStrap bootstrap = new BootStrap() b.group(bossGroup) .channel(NioDatagramChannel.class) .option(ChannelOption.SO_BROADCAST, true)
当前都是基于TCP协议的版本,没有验证过UDP。 建议对照Netty的UDP使用来尝试是否可以拓展,如果有没法拓展的接口请联系我。欢迎提PR来共建!
Your question
该如何创建udp 协议呢?我看了下默认是tcp的?
如果我要创建udp相关的服务端 我需要手动去扩展这部分代码吗 ` this.bootstrap = new ServerBootstrap(); this.bootstrap .group(bossGroup, workerGroup) .channel(NettyEventLoopUtil.getServerSocketChannelClass()) .option(ChannelOption.SO_BACKLOG, ConfigManager.tcp_so_backlog()) .option(ChannelOption.SO_REUSEADDR, ConfigManager.tcp_so_reuseaddr()) .childOption(ChannelOption.TCP_NODELAY, ConfigManager.tcp_nodelay()) .childOption(ChannelOption.SO_KEEPALIVE, ConfigManager.tcp_so_keepalive()) .childOption(ChannelOption.SO_SNDBUF, tcpSoSndBuf != null ? tcpSoSndBuf : ConfigManager.tcp_so_sndbuf()) .childOption(ChannelOption.SO_RCVBUF, tcpSoRcvBuf != null ? tcpSoRcvBuf : ConfigManager.tcp_so_rcvbuf());
感谢平台 感谢开源
Your scenes
需要udp 消息和tcp的广播
Your advice
describe the advice or solution you'd like
Environment
java -version
):1.8uname -a
):win7