-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I write a project, where client is written in lua, while the server is written in c/c++. We use socket connection with protobuf as the communication protocol.
we are pleased to notice you provide the protobuf for lua. However, we discover the decode process is not stable. Sometimes success, sometimes fail. The followings are the message.
the fail msg:
Cocos2d: code_ : 4 , data_ is �{�\365\202\212��, length is 11
Cocos2d: the uid is 123, attack is 0 ==>this is use c to decode, we get the correct result
Cocos2d: [LUA-print] code: 4 , data : �{�\365\202\212��
Cocos2d: [LUA-print] ----------------------------------------
Cocos2d: [LUA-print] LUA ERROR: [string "decoder.lua"]:92: Truncated message.
Cocos2d: [LUA-print] stack traceback:
…A9FEB53-09AB-49C1-B08C-9245EE65C750/CardNba.app/Main.lua:6: in function <…A9FEB53-09AB-49C1-B08C-9245EE65C750/CardNba.app/Main.lua:3>
[C]: in function 'error'
[string "decoder.lua"]:92: in function 'field_decoder'
[string "protobuf.lua"]:684: in function '_internal_parse'
[string "protobuf.lua"]:693: in function 'merge_from_string'
[string "protobuf.lua"]:702: in function 'ParseFromString'
[string "luaScript/MySocket.lua"]:141: in function 'logic'
[string "luaScript/MySocket.lua"]:92: in function <[string "luaScript/MySocket.lua"]:81>
the success msg.
Cocos2d: code_ : 4 , data_ is �{�\365\202\212��� �, length is 11
Cocos2d: the uid is 123, attack is 1
Cocos2d: [LUA-print] code: 4 , data : �{�\365\202\212��� �
Cocos2d: [LUA-print] init.uid: 123 , init.attack : 1 ,
the proto structure is
message GameInitResult
{
optional int32 uid = 1;
optional int32 opponent = 2;
optional int32 attack = 3;
optional int32 game_type = 4;
}
we are hoping to hear from you asps