This operation is done by a Task asynchronously (other Tasks will be executed concurrently without blocking execution flow)
Ftp:command(cmd, [response])
Sends and executes the provided command to the FTP server.
Parameters
cmd
A string
that contains the command to execute.
response
An optional boolean
value indicating if the Task should wait for a response.
Return value
This method return a Task instance. Once the Task has finished, it will return a
boolean
value indicating if the operation was successful.
Example
local net = require "net"
-- connect to the FTP server
local url = "your ftp server"
local client = net.Ftp(url, "username", "password")
-- Execute the LIST command
if await(client:command("LIST /")) then
print("LIST command result :")
else
error(net.error)
end