[luci] running .lua when the modem is booting ( starting ) ?

Michael musset mickamusset at gmail.com
Fri Oct 2 03:13:29 CEST 2009


Hi,


 thanks for the nixio code ! it's work on my fonera, it's so cool !!!!

---------------------------------------------------------
open fonera.lan 1234
Connect to 192.168.10.1:1234
<2.12> *OPEN*Write data to client*CLOS*
------------------------------------------------------------


i'm so happy, my question is now how to start a .lua when the modem is
booting ( starting )?


is it with luci.sys.init class ? :s


please help me ^^


thanks a lot !



Message: 2
Date: Tue, 29 Sep 2009 11:44:06 +0200
From: Steven Barth <steven at midlink.org>
Subject: Re: [luci] TCP connection and listening a port
To: luci at lists.subsignal.org
Message-ID: <200909291144.07006.steven at midlink.org>
Content-Type: Text/Plain;  charset="iso-8859-1"

Using nixio is like using sockets in C, the function calls are very similar.
A small example

require "nixio", require "nixio.util"
mysocket = nixio.bind(nil, 1234) --Port to listen on
mysocket:listen(32)

while true do
 client = mysock:accept()
 if nixio.fork() == 0 then -- Create a new process
   break
 end
 client:close() -- Close client connection in main process
 nixio.wait(nil, "nohang") -- Kill zombies
end

-- This is the client process
data = client:read(1024)
print("Recevied data from client:", data)

client:write("Write data to client")
client:close()


------------------------------


More information about the luci mailing list