MCPcopy Index your code
hub / github.com/aceld/zinx / main

Function main

examples/zinx_decoder/server/server.go:19–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func 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}

Callers

nothing calls this directly

Calls 7

SetOnConnStartMethod · 0.95
SetOnConnStopMethod · 0.95
AddRouterMethod · 0.95
SetDecoderMethod · 0.95
ServeMethod · 0.95
NewServerFunction · 0.92
NewHTLVCRCDecoderFunction · 0.92

Tested by

no test coverage detected