view download.lua @ 9:129ac4eef472 default tip

Add comments to the code.
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 07 Jun 2015 14:38:33 +0200
parents f10747e8ce4f
children
line wrap: on
line source

function download(filename)
    file.remove(filename); file.open(filename, 'w')
    socket = net.createConnection(net.TCP, 0)
    socket:on("receive", function(sck, data) file.write(data) end)
    socket:on("disconnection", function(sck) file.close(); sck:close() end)
    socket:connect(2121, "192.168.0.11")
end