示例#1
0
//初始化
func InitClient(ip string, port string) error {
	//连接DB服务器
	addr := ip + ":" + port
	client, err := global.Connect("DBServer", "tcp", addr, global.PackCodecType_Safe, clientMsgDispatch)
	if err != nil {
		return err
	}

	dbClient = client
	sendConnectDBServer()

	return nil
}
//初始化
func InitClient(ip string, port string) error {
	//连接LogServer
	addr := ip + ":" + port
	client, err := global.Connect("LogServer", "tcp", addr, global.PackCodecType_Async, clientMsgDispatch)
	if err != nil {
		return err
	}

	logClient = client
	sendConnectLogServer()

	return nil
}