MCPcopy
hub / github.com/aceld/zinx / Clinet

Function Clinet

znotify/notify_test.go:44–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func Clinet() {
45 //conf.ConfigInit()
46
47 for i := 0; i < 9000; i++ {
48 go func(i int) {
49 conn, err := net.Dial("tcp", "127.0.0.1:9991")
50 if err != nil {
51 fmt.Println("net dial err:", err)
52 return
53 }
54 defer conn.Close()
55 //连接调用write方法写入数据
56 id := strconv.Itoa(i)
57 dp := zpack.NewDataPack()
58 msg, err := dp.Pack(zpack.NewMsgPackage(1, []byte(id)))
59 if err != nil {
60 return
61 }
62 _, err = conn.Write(msg)
63
64 if err != nil {
65 return
66 }
67 select {}
68 }(i)
69 }
70}
71
72func ClientJoin() {
73 t := time.NewTicker(50 * time.Millisecond)

Callers 1

initFunction · 0.85

Calls 5

PackMethod · 0.95
NewDataPackFunction · 0.92
NewMsgPackageFunction · 0.92
CloseMethod · 0.80
WriteMethod · 0.80

Tested by

no test coverage detected