As the title says... Chat on...

User avatar
By kenji
#31084 an Ajax data to be send in binary not string..How to make it?
gotvalue is a hex binary table , I want it be sent as it is not ascii....

code is as below:

srv=net.createServer(net.TCP)
srv:listen(80,function(conn)

conn:on("receive", function(client,payload)
tgtfile = string.sub(payload,string.find(payload,"GET /")
+5,string.find(payload,"HTTP/")-2)

if tgtfile == "TH300" then
for i=1,#gotvalue,1 do
client:send(gotvalue[i]) ------ the gotvalue[i] become ascii not binary
end

elseif tgtfile == "modbus" then
client:send("<html>")
client:send(tgtfile.." modbusPV SV etc..<BR>")
client:send("<a href='index.htm'>Home</a><BR>")