Netty
KiMiWaWonderful
我就是个傲娇的孩子
展开
-
远程netty客户端连接上部署在云服务器上的netty服务端
感动天感动地,终于可以连接上服务器了。。。。看到篇问题和我一模一样的博客:https://segmentfault.com/q/1010000015717059看了一下下面的解答,大致就是公网IP并不是云服务器上的IP啥的。通过vim /etc/hosts,添加:公网IP 自定义域名然后修改客户端程序:@PostConstruct public void start() th...原创 2020-01-07 13:09:30 · 1475 阅读 · 2 评论 -
使用Netty实现一个小型服务器(作为数据中转站)
项目需要,要写一个服务器作为数据中转站,服务器接收客户端发送的数据,再转发给其他客户端。客户端可以自己写一个测试是否可以连接和接收数据,也可以是4G模块或者单片机啥的。客户端代码:我的项目目录结构:代码如下:NettyServer.javaimport io.netty.bootstrap.ServerBootstrap;import io.netty.channel.Channe...原创 2020-01-04 18:05:18 · 2118 阅读 · 7 评论 -
win10+google protobuffer +IDEA的配置
一、下载google-protoc for win的zip包(https://github.com/protocolbuffers/protobuf)二、配置环境标量,在CMD里使用protoc --version查看三、在IDEA里安装protobuf support插件四、在工程的main目录下新建一个文件夹,用来存放.proto的文件。然后把该文件夹Mark directory as ...原创 2019-05-24 17:01:40 · 593 阅读 · 0 评论 -
Netty + Goole Protobuf报错:Protocol message contained an invalid tag (zero).
参考文章:http://www.starmcu.com/archives/645在客户端和服务端的Initializer里要注意顺序:ProtobufEncoder要放在ProtobufVarint32LengthFieldPrepender后面。public class MySixthClientInitializer extends ChannelInitializer<Socke...原创 2019-06-03 17:05:47 · 4361 阅读 · 1 评论