package nnet import ( "git.noahlan.cn/noahlan/nnet/connection" "git.noahlan.cn/noahlan/ntool/nlog" "net" ) // DialTCP 连接服务器 func (ngin *Engine) DialTCP(addr string) (*connection.Connection, error) { err := ngin.setup() if err != nil { nlog.Errorf("%s failed to setup server, err:%v", ngin.LogPrefix(), err) return nil, err } conn, err := net.Dial("tcp", addr) nlog.Must(err) nlog.Infof("%s now connect to %s...", ngin.LogPrefix(), addr) return ngin.handle(conn), nil }