程序包 com.walker.tcp

接口 ServerHandler<T>

所有已知实现类:
AbstractStringHandler, LongHandler, MyLongHandler, MyMessageHandler, WebsocketHandler

public interface ServerHandler<T>
系统抽象的TCP通信handler接口,用于隔离第三方组件的接口方法。
作者:
时克英
  • 方法详细资料

    • onConnected

      void onConnected(String id) throws Exception
      当客户端连接上时,回调改方法
      参数:
      id - 连接通道全局唯一ID,由系统生成
      抛出:
      Exception
    • onDisConnected

      void onDisConnected(String id) throws Exception
      抛出:
      Exception
    • onRead

      void onRead(Connection conn, T msg) throws Exception
      抛出:
      Exception
    • onReadComplete

      void onReadComplete(T msg, String id, io.netty.channel.ChannelHandlerContext ctx) throws Exception
      读完请求数据后的方法调用
      参数:
      msg - 消息体
      id - 通道ID
      抛出:
      Exception
    • onException

      void onException(Throwable cause) throws Exception
      抛出:
      Exception
    • getEngineId

      int getEngineId()
    • getConnectionManager

      ConnectionManager getConnectionManager()
    • setEmptyMsgDisconnect

      void setEmptyMsgDisconnect(boolean result)
      设置选项:接收到客户端空数据时,是否断开连接,默认:false

      因为存在情况,有些终端在关机时会向服务端发送空数据。
      参数:
      result -