So I’m using TCP and UDB with Lua sockets.
With TCP as I want to send “packages” in varied serialized sizes I’m using “*l” as a pattern when recieving the data.
Problem is that whenever a byte (or string char if you like) happens to have the number 10 (or 13) the package breaks as it is the linefeed char that “ends” the package. So whenever I am unfortunate to have a serialized data that contains a byte of 10 the package gets totally broken.
I have been trying to use “*a” but it doesnt seem to work. This never gets anything.
-- RECEIVE
local data, err = con.tcp_client:receive("*a")
while data do
con:unpack_packet(data)
data, err = con.tcp_client:receive("*a")
end
I haven’t been able to find a solution to this yet. Any suggestions?