()
| 17 | } |
| 18 | |
| 19 | func main() { |
| 20 | //zlog.SetLogFile("./logs", "app.log") |
| 21 | s := znet.NewServer() |
| 22 | |
| 23 | s.SetOnConnStart(DoConnectionBegin) |
| 24 | s.SetOnConnStop(DoConnectionLost) |
| 25 | |
| 26 | // TLV protocol corresponding to business function |
| 27 | // TLV协议对应业务功能 |
| 28 | s.AddRouter(0x00000001, &router.TLVBusinessRouter{}) |
| 29 | |
| 30 | // Process HTLVCRC protocol data |
| 31 | // 处理HTLVCRC协议数据 |
| 32 | s.SetDecoder(zdecoder.NewHTLVCRCDecoder()) |
| 33 | |
| 34 | // TLV protocol corresponding to business function, because the funcode field in client.go is 0x10 |
| 35 | // TLV协议对应业务功能,因为client.go中模拟数据funcode字段为0x10 |
| 36 | s.AddRouter(0x10, &router.HtlvCrcBusinessRouter{}) |
| 37 | |
| 38 | // TLV protocol corresponding to business function, because the funcode field in client.go is 0x13 |
| 39 | // TLV协议对应业务功能,因为client.go中模拟数据funcode字段为0x13 |
| 40 | s.AddRouter(0x13, &router.HtlvCrcBusinessRouter{}) |
| 41 | |
| 42 | //开启服务 |
| 43 | s.Serve() |
| 44 | } |
nothing calls this directly
no test coverage detected