MCPcopy Create free account
hub / github.com/e2wugui/zeze / onSendKeepAlive

Method onSendKeepAlive

ZezeJava/ZezeJava/src/main/java/Zeze/Net/Service.java:916–919  ·  view source on GitHub ↗

1. 如果你是handshake的service,重载这个方法,按注释发送KeepAlive即可【已改成默认发送,不需要操作】; 2. 如果你是其他service子类,重载这个方法,按注释发送KeepAlive,并且服务器端需要注册这条协议并写一个不需要处理代码的handler; 3. 如果不发送, 会导致KeepTimerClient时间后再次触发, 也可以调用socket.setActiveSendTime()避免频繁触发。 @param socket 当前连接

(@NotNull AsyncSocket socket)

Source from the content-addressed store, hash-verified

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);

Callers 1

checkKeepAliveMethod · 0.95

Calls 1

SendMethod · 0.45

Tested by

no test coverage detected