Hi everyone, I have problem when using wxSocket in wxLua, ReadMsg return some garbage at the end of the string. The senario is:
c. WriteMsg(luastr, luastr:len()) s. ReadMsg(80) // 80 is assured to be much bigger than luastr:len() If using in C++ (wxWidgets) the buffer returned by ReadMsg (even the nbytes is much bigger than the len actually written to socket) is the correct len. Have looked at the wxWidget source code and verify this. However if using it in Lua, I get garbage string at the end. So I propose to change this line: lua_pushlstring(L, (const char *)buffer, nbytes); to lua_pushlstring(L, (const char *)buffer, self->LastCount()); // skieu in wxLua_wxSocketBase_Read(lua_State *L) and wxLua_wxSocketBase_ReadMsg(lua_State *L) I am not sure of the side effect of that change but it worked for me, I never get any garbage since then :-) Any comment? Cheers S.KIEU Send instant messages to your online friends http://au.messenger.yahoo.com ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wxlua-users mailing list Wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users