Android Netty Server

项目源码在github上,请看这里-->Android Netty Server

Android netty server

Start a netty server on android

Download netty

Download url :https://netty.io/downloads.html

Download netty-all.jar and put it into libs. Then add as library.

Project structure

netty

AppServer

AppServerHandler

AppServerInitializer

IServer

MessageProtocol

TcpProtoCodec

MainActivity

MessageEvent

AppServerHandler: handle channel add, remove and activity. in this class, channelRead0 will handle the message which send by client.

AppServerInitializer: initialize AppServer. Then add Tcp Protocol Codec and AppServerHandler.

AppServer: start netty server.

MessageProtocol: netty send and receive message format.

MessageEvent: use for eventbus.

MainActivity: show receive message content.

Communication protocol

'R' + data.length + data

上一篇:【持续更新】一个简洁、易用的美赛 LaTeX 模板: easyMCM


下一篇:FineUI开源版(ASP.Net)开发实践-目录