Android Netty Client

Posted on 2018-01-08 08:39  xl_phoenix  阅读(679)  评论(0)    收藏  举报

Android netty client

Start a netty client 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

ClientWrapper

ControlClient

MessageProtocol

ServerException

ServerStatus

StatusListener

TcpProtoCodec

Constants

MainActivity

MessageEvent

ClientWrapper: package ControlClient, use single mode. init and notify server status change.

ControlClient: connect server, send message and listen status change.

MessageProtocol: netty send and receive message format.

ServerException: exception

MessageEvent: use for eventbus.

MainActivity: input server ip and port, connect server and send message

Communication protocol

'R' + data.length + data

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3