1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-09 20:08:06 +11:00
OC-Minitel/FRequest/OpenOS/usr/bin/fget.lua

21 lines
401 B
Lua

local net = require "net"
local event = require "event"
local tArgs = {...}
local host, path = tArgs[1], tArgs[2]
local port = 70
local sep = host:find(":")
if sep then
port=tonumber(host:sub(sep+1)) or port
host=host:sub(1,sep-1)
end
local socket = net.open(host,port)
socket:write(path.."\n")
repeat
l = socket:read(1024)
io.write(l)
os.sleep(0.5)
until socket.state == "closed" and l == ""