客户端增加Invoke

This commit is contained in:
nnhy 2016-05-12 07:55:58 +00:00
parent 5eb8a5e480
commit a93d9c0871
2 changed files with 33 additions and 2 deletions

View File

@ -117,6 +117,9 @@ bool TokenClient::OnReceive(TokenMessage& msg, Controller* ctrl)
case 0x07:
OnRegister(msg, ctrl);
break;
case 0x08:
OnInvoke(msg, ctrl);
break;
}
// 消息转发
@ -540,3 +543,22 @@ bool TokenClient::ChangeIPEndPoint(const String& domain, ushort port)
return true;
}
void TokenClient::Invoke(const String& action, Buffer& bs)
{
TokenMessage msg;
auto ms = msg.ToStream();
BinaryPair bp(ms);
bp.Set("Action", action);
ms.Write(bs);
Control->Send(msg);
}
void TokenClient::OnInvoke(TokenMessage& msg, Controller* ctrl)
{
}

View File

@ -66,6 +66,15 @@ public:
void Ping();
bool OnPing(TokenMessage& msg, Controller* ctrl);
bool ChangeIPEndPoint(const String& domain, ushort port);
void Read();
void OnRead(TokenMessage& msg, Controller* ctrl);
void Write();
void OnWrite(TokenMessage& msg, Controller* ctrl);
// 远程调用
void Invoke(const String& action, Buffer& bs);
void OnInvoke(TokenMessage& msg, Controller* ctrl);
};
// 令牌会话