Closer to release...
This commit is contained in:
parent
307603b24d
commit
f18d1b7cd0
31 changed files with 163 additions and 77 deletions
|
@ -1,25 +1,23 @@
|
|||
-- load tftpclng.lua
|
||||
assert(dofile("../examples/tftpclnt.lua"))
|
||||
-- load tftpclnt.lua
|
||||
dofile("tftpclnt.lua")
|
||||
|
||||
-- needs tftp server running on localhost, with root pointing to
|
||||
-- /home/i/diego/public/html/luasocket/test
|
||||
-- a directory with index.html in it
|
||||
|
||||
function readfile(file)
|
||||
local f = openfile("file", "rb")
|
||||
local a
|
||||
if f then
|
||||
a = read(f, "*a")
|
||||
closefile(f)
|
||||
end
|
||||
return a
|
||||
local f = io.open(file, "r")
|
||||
if not f then return nil end
|
||||
local a = f:read("*a")
|
||||
f:close()
|
||||
return a
|
||||
end
|
||||
|
||||
host = host or "localhost"
|
||||
print("downloading")
|
||||
err = tftp_get(host, 69, "index.html", "index.got")
|
||||
assert(not err, err)
|
||||
original = readfile("index.index")
|
||||
original = readfile("test/index.html")
|
||||
retrieved = readfile("index.got")
|
||||
remove("index.got")
|
||||
os.remove("index.got")
|
||||
assert(original == retrieved, "files differ!")
|
||||
print("passed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue