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

Function main

examples/zinx_tls/client/client.go:34–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34func main() {
35 // Create a TLS client.
36 c := znet.NewTLSClient("127.0.0.1", 8899)
37
38 c.SetOnConnStart(func(connection ziface.IConnection) {
39 go func() {
40 for {
41 err := connection.SendMsg(1, []byte("Ping with TLS"))
42
43 if err != nil {
44 fmt.Println(err)
45 break
46 }
47
48 time.Sleep(1 * time.Second)
49 }
50 }()
51
52 })
53
54 c.AddRouter(2, &PongRouter{})
55
56 c.Start()
57
58 wait()
59}

Callers

nothing calls this directly

Calls 6

NewTLSClientFunction · 0.92
waitFunction · 0.70
SetOnConnStartMethod · 0.65
SendMsgMethod · 0.65
AddRouterMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected