TCP链接

首先创建子类实现 ClientChannelRead 接口,且实现方法 tackle 在 tackle 方法中编写自己的业务代码

*只能在子类注入 model接口,在其他地方注入容易造成数据链接丢失问题。如图所示:

获取客户端链接

String host = "127.0.0.1"; int port = 8888; SocketClient socketClient = SocketClient.getSocketClient(host,port,,new TestClient());

向服务端发送数据

socketClient.sendData("dddddd");
本文档来自—microbee-http 丨 软件开发框架平台