PDA

View Full Version : IRTRANS control by netremote



LMSN
September 8th, 2009, 06:26 PM
Hello,

I'm new to netremote and definately to LUA but I have a little programming and networking background.
I would like to have an IRTrans LAN controller sending IR commands by sending messages to it by UDP via a netremote CCF installed on my IPAQ214.

I think the best way to do so is using the LUA socket library.
By netremote designer I created a CCF with a button with the next lua code behind it (action to execute on button down):

host = 192.168.1.100
port = 12345
udp = socket.udp()
nsent, err = udp:sendto("anything", host, port)

I'm using an udp testtool which is configured to listen to port 12345. When I open the CCF in netremote and when I push the button, nothing seems to happen.
Sending UDP messages from the testtool itself to the above mentioned IP/port works, they show up in the receive window.
Could anyone tell me what 's wrong or missing in my code?
I already tried to put the IP address and port between "" or ' ' but this doesn't seem to help also.
Of course proposals about other ways to send UDP messages from netremote or on how to control the IRTrans module are welcome!

thanks in advance!

Rob H
September 8th, 2009, 06:42 PM
That host should be in quotes - otherwise it looks okay.

mpg732
September 8th, 2009, 06:44 PM
I don't knowhow to help you with the LUA issues but you might want to take a look at this for your hardware "Global Cache GC-100 Network Adapter" Not sure on how to make it work with Netremote, but Im sure it can be done.

Rob H
September 9th, 2009, 06:55 AM
can you add


print(nsent, err)
after the call to udp:sendto() ?

And check either the Lua console in NetRemote Designer or use DebugView to see what the result is.

The only other thing that springs to mind is that this may be a firewall issue.

LMSN
September 9th, 2009, 03:10 PM
Hello,

Thank you all for the quick respons and usefull suggestions!
After adding print(nsent, err) at the end, I get next feedback in the luaconsole window:

Lua (Unknown)
host = "192.168.1.100"
port = 12345
udp = socket.udp()
nsent, err = udp:sendto("Hoi", host, port)
print(nsent, err);
Error running lua chunk
[string "NRLUA"]:3: attempt to index global `socket' (a nil value)

Does this mean that there is something going wrong at line 3 with udp=socket.udp() ? It noticed files like http.lua, ftp.lua but no udp.lua file in my C:\program files\promixis\netremote\lua\socket\... folder.
Could that be the reason?
If so, where can I get it? In the luasocket.zip file which I can find on luaforge.net/frs/?group_id=23 there's also no udp.lua file present.

Thanks again!

Rob H
September 9th, 2009, 05:34 PM
Oops, missed that, try


require "socket"

as the first line of that script

LMSN
September 10th, 2009, 03:26 PM
OK, solved!! It works perfect on y PC.

Thanks a lot!