Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the communication between the lua and c++ is not stable #1

Open
shiningstarpxx opened this issue Jan 23, 2014 · 0 comments
Open

the communication between the lua and c++ is not stable #1

shiningstarpxx opened this issue Jan 23, 2014 · 0 comments

Comments

@shiningstarpxx
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant