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

Function NewClient

znet/client.go:64–86  ·  view source on GitHub ↗
(ip string, port int, opts ...ClientOption)

Source from the content-addressed store, hash-verified

62}
63
64func NewClient(ip string, port int, opts ...ClientOption) ziface.IClient {
65
66 c := &Client{
67 // Default name, can be modified using the WithNameClient Option
68 // (默认名称,可以使用WithNameClient的Option修改)
69 Name: "ZinxClientTcp",
70 Ip: ip,
71 Port: port,
72
73 msgHandler: newCliMsgHandle(),
74 packet: zpack.Factory().NewPack(ziface.ZinxDataPack), // Default to using Zinx's TLV packet format(默认使用zinx的TLV封包方式)
75 decoder: zdecoder.NewTLVDecoder(), // Default to using Zinx's TLV decoder(默认使用zinx的TLV解码器)
76 version: "tcp",
77 errChan: make(chan error, 1),
78 }
79
80 // Apply Option settings (应用Option设置)
81 for _, opt := range opts {
82 opt(c)
83 }
84
85 return c
86}
87
88func NewWsClient(ip string, port int, opts ...ClientOption) ziface.IClient {
89

Callers 15

mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92

Calls 4

FactoryFunction · 0.92
NewTLVDecoderFunction · 0.92
newCliMsgHandleFunction · 0.85
NewPackMethod · 0.80

Tested by

no test coverage detected