Tcp长连接 Netty封装 功能:开启,关闭,自动重连设置,心跳设置等
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
app
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

NettyDemo

Netty 封装 功能:开启,关闭,自动重连,心跳设置等,具体请参考demo

Usage


 new Thread(new Runnable() {
            @Override
            public void run() {
                new EchoClient(host, port, new EchoClient.EchoCallBack() {
                    @Override
                    public void onConnSucess(ChannelHandlerContext type,String result) {
                        mChannelHandlerContext=type;
                        Log.i("LLL", "onConnSucess " + result);
                    }

                    @Override
                    public void onReceive(String result) {
                        Log.i("LLL", "onReceive "+"\r\n" + result);
                    }

                    @Override
                    public void onExceptionTip(String result) {
                        Log.i("LLL", "onExceptionTip " + result);
                    }

                    @Override
                    public void onManualClose(String result) {
                        Log.i("LLL", "onManualClose " + result);
                    }

                    @Override
                    public void onReconn() {
                        Log.i("LLL", "onReconn-------------------------------------- ");
                        conn(host, port);
                    }
                }).start();
            }
        }).start();