I'm wondering if there's a way to see when the client sends a packet, what header it sends, and how I can deal with it. If in instance, a client sends a header like : 0xAA, how would I reply to that?
This is what I currently have.
socket = require("socket")
server = assert(socket.bind("*", 11000))
ip, port = server:getsockname()
while true do
local client = server:accept()
client:settimeout(0)
client:send(string.char(0xEC,0x2C,0x4A,0x00)) -- Reply
end
What I'm looking for is when the connected client sends an packet, the server reads the header, and I can choose what packet I wish to send back (the reply is sent instantly when a client connects)