This commit is contained in:
aozhiwei 2019-12-11 17:24:33 +08:00
parent a68691dc1f
commit d209bb23c7
2 changed files with 18 additions and 0 deletions

View File

@ -116,6 +116,22 @@ namespace f8
return sizeof(PackHead) + packlen;
}
int Net_SendMsgOld(a8::TcpClient* tcp_client, unsigned int seqid,
unsigned short msgid, ::google::protobuf::Message& msg)
{
int packlen = msg.ByteSize();
char* buff = (char*)malloc(sizeof(f8::PackHeadOld) + packlen);
f8::PackHeadOld* head = (f8::PackHeadOld*)buff;
head->packlen = packlen;
head->msgid = msgid;
head->magiccode = MAGIC_CODE;
msg.SerializeToArray(buff + sizeof(f8::PackHeadOld), packlen);
tcp_client->SendBuff(buff, sizeof(f8::PackHeadOld) + packlen);
free(buff);
return sizeof(f8::PackHeadOld) + packlen;
}
int Net_SendMsg(a8::TcpClient2* tcp_client, unsigned seqid, unsigned short msgid,
::google::protobuf::Message& msg)
{

View File

@ -108,6 +108,8 @@ namespace f8
void Net_PackMsgOld(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out);
int Net_SendMsg(a8::TcpClient* tcp_client, unsigned int seqid,
unsigned short msgid, ::google::protobuf::Message& msg);
int Net_SendMsgOld(a8::TcpClient* tcp_client, unsigned int seqid,
unsigned short msgid, ::google::protobuf::Message& msg);
int Net_SendMsg(a8::TcpClient2* tcp_client, unsigned int seqid,
unsigned short msgid, ::google::protobuf::Message& msg);
int Net_SendBigMsg(a8::TcpClient* tcp_client, unsigned int seqid,