MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / Connect

Method Connect

client/internal/network/conn.go:39–50  ·  view source on GitHub ↗
(addr string)

Source from the content-addressed store, hash-verified

37}
38
39func (t *TCPClient) Connect(addr string) error {
40 t.Close()
41 conn, err := net.Dial("tcp", addr)
42 if err != nil {
43 return errors.Wrap(err, "dial tcp error")
44 }
45 t.lock.Lock()
46 defer t.lock.Unlock()
47 t.conn = conn
48 t.connected = true
49 return nil
50}
51
52func (t *TCPClient) Write(buf []byte) error {
53 if conn := t.getConn(); conn != nil {

Callers 1

connectMethod · 0.80

Calls 1

CloseMethod · 0.95

Tested by

no test coverage detected