You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
564 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package GRpcUtil
import (
"dsSupport/Utils/ConfigUtil"
"dsSupport/Utils/LogUtil"
"fmt"
"github.com/0x5010/grpcp"
"google.golang.org/grpc"
)
/**
功能:获取连接
作者:黄海
时间2020-4-15
*/
func GetConnection() *grpc.ClientConn {
//连接的服务器地址
var address = ConfigUtil.RpcServerIp + ":" + ConfigUtil.RpcServerPort
//建立链接
conn, err := grpcp.GetConn(address) // get conn with grpcp default pool
if err != nil {
LogUtil.Error("连接RPC服务器发生错误", err.Error())
fmt.Println(err.Error())
}
return conn
}