luasocket从端口1900发送UDP数据(luasocket send UDP data from port 1900)
我正试图从我的家庭自动化控制器Emulate Belkin wemo开关发送来自amazon Echo的语音命令。控制器支持lua语言。
我正在跟踪此文件 ,将UDP数据从Controller的1900端口发送到Echo的端口50000。 现在我每次发送数据时Socket都会随机端口发送数据而不是从端口1900发送数据。回显只做有效连接并回复数据是否来自端口1900.我在最近两天摸不着头脑但还没想出来。
贝娄是我的代码。
strData1 =
'HTTP/1.1 200 OK' ..
'HOST: 239.255.255.250:1900'..
'CACHE-CONTROL: max-age=100'..
'EXT:'..
'LOCATION: http://192.168.1.152:49153/description.xml'..
'SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.19.0'..
'hue-bridgeid: B8AC6FFFFEC53475'..
'ST: upnp:rootdevice'..
'USN: uuid:2f402f80-da50-11e1-9b23-b8ac6fc53475::upnp:rootdevice'
local socket = require "socket"
local udp = socket.udp()
udp:settimeout(0)
udp:setsockname('*', 1900)
udp:setpeername('192.168.1.102', 50000) -- Echo IP and Port number
udp:sendto(strData1,'192.168.1.102',50000)
I am trying to Emulate Belkin wemo switch from my Home automation controller to send voice command from amazon Echo.The controller supports lua language.
I am following up this file to send the UDP data from port 1900 of Controller to port 50000 of Echo. right now every time i send the data the Socket take the random port send data not from port 1900. Echo only make valid connection and reply if the data comes from the port 1900. I am scratching my head from last two