nickbelvedere 0 Posted October 27, 2015 Share Posted October 27, 2015 Hello guys, how can I send bytes on a TCP connection? I had success sending strings, but I'm interested in sending some bytes down the line. Thanks! Quote Link to post Share on other sites
0 Gangsir 14 Posted October 28, 2015 Share Posted October 28, 2015 You could try using the serialization api. http://ocdoc.cil.li/api:serialization Quote Link to post Share on other sites
0 natedogith1 4 Posted October 28, 2015 Share Posted October 28, 2015 You're going to want to do write the bytes to the stream using string.char As an example, you can look at a program I made a while ago (it's slow from what I recall, but I was just testing stuff). http://pastebin.com/NLvQmUYh Quote Link to post Share on other sites
0 dgelessus 26 Posted November 4, 2015 Share Posted November 4, 2015 In Lua, strings are just bytes. There is no distinction between text and raw data (like in Java or Python), instead all characters represent their ASCII byte value. (Well, Lua makes no promises about which character set is actually used, but in almost all cases it's ASCII or a superset of it, like Latin-1.) Unicode characters are represented by UTF-8 byte sequences, there is no native Unicode support in Lua, except for the utf8 library that provides a few utilities for encoding and decoding UTF-8 strings. Quote Link to post Share on other sites
Hello guys,
how can I send bytes on a TCP connection? I had success sending strings, but I'm interested in sending some bytes down the line.
Thanks!
Link to post
Share on other sites