1. 如果你是handshake的service,重载这个方法,按注释发送KeepAlive即可【已改成默认发送,不需要操作】; 2. 如果你是其他service子类,重载这个方法,按注释发送KeepAlive,并且服务器端需要注册这条协议并写一个不需要处理代码的handler; 3. 如果不发送, 会导致KeepTimerClient时间后再次触发, 也可以调用socket.setActiveSendTime()避免频繁触发。 @param socket 当前连接
(@NotNull AsyncSocket socket)
| 914 | * @param socket 当前连接 |
| 915 | */ |
| 916 | @SuppressWarnings("MethodMayBeStatic") |
| 917 | protected void onSendKeepAlive(@NotNull AsyncSocket socket) { |
| 918 | KeepAlive.instance.Send(socket); // skip result |
| 919 | } |
| 920 | |
| 921 | public @NotNull DatagramSocket bindUdp(@NotNull InetSocketAddress local) throws IOException { |
| 922 | return new DatagramSocket(this, local); |