czt
2026-02-11 f68f5bf6ae56c18561eb8ccba9fb9693f128551c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.fzzy.igds.quantity.server;
 
import com.fzzy.igds.quantity.util.ServerUtils;
import com.ld.io.api.IoSession;
import com.ld.io.api.IoSessionListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
/**
 * @Description
 * @Author CZT
 * @Date 2026/01/08 16:36
 */
@Slf4j
@Service
public class BhznQuantitySessionListener implements IoSessionListener {
 
    @Override
    public void onCreate(IoSession session) {
        log.info("++++新建连接++++-IP={},PORT={}", session.getAddress(), session.getPort());
        // 添加自定义业务ID
        session.setBusinessKey(ServerUtils.getServerKey(session.getAddress(), session.getPort()));
    }
 
    @Override
    public void onDestroy(IoSession session) {
        log.info("----连接断开-----IP={},PORT={}", session.getAddress(), session.getPort());
 
    }
}