I have read the docs, and I am trying to make a standalone lua exe to connect to a server using socket.tcp and parse the the datarecieved. Im more the familiar in how to do this in simple languages like Visual Basic. Some help if anyone can suggest anything.
connection = require "luasocket"
socket = require "socket"
local status = connection:recieve(2^10)
repeat
connection = assert(socket.connect(host, port))
connection:timeout(20)
connection:send(username .. "\r" .. password .. "\r\n")
until status == "connected"
I think that should connect to the server, but if it does im a bit unaware as how to capture incoming data to parse it. In c I would hook on inheritance
should i try that in a loop until i recieve a complete packet? or once i use it will it wait in execution until it recieves something.
should i try that in a loop until i recieve a complete packet? or once i use it will it wait in execution until it recieves something.
I would like to wait for the socket to recieve data, grab the first two bytes of it to refer to how long the rest of the data im trying to parse will be.
crap sorry for double post