[ZeroBrane Studio] luasocket receive

  • From: Renaud Kern <renaud.kern@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Tue, 2 Sep 2014 16:23:53 +0200

Hello,

I've a lua script that use luasocket to listen to a specific port (3333).
It work fine on the terminal but stop on ZBS. The script basically do this
:

local socket = require "socket"
local server = assert(socket.bind("*", 3333))

function listen(server)
    local client = server:accept()
    client:settimeout(10)
    local line, err, partial = client:receive("*l")
    -- do something and store result
    if result then
      client:send(rslt.."\n")
      client:close()
    else
      client:close()
    end
  end

  while true do
    if listen(server)
  end

On ZBS the process execution freeze actually when "receive()" is called :
local line, err, partial = client:receive("*l")

Is luasocket in conflict with ZBS ?

Thanks,

Renaud

Other related posts: