class Ftp::FTPServer

Overview

Example of utilisation

include Ftp
server = FTPServer.new(8000, ".")
server.start
sleep

This will launch a FTP server, listening for clients at port 8000, rooted in the current directory

Defined in:

ftp.cr
commands.cr

Constant Summary

ANONYMOUS = "anonymous"

Downcased anonymous username (meaning connecting with it will start an anonymous session)

PASSWORD = "password"

Default password for new users

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(port : Int32 = 2121, root : String = ".") #

Create a FTP server, configurate to listen to #port, and mounted on #root

my_ftp_server = Ftp::FTPServer.new(port: 8000, root: "/home")

NOTE : The returned FTP server is not listening for clients : it needs to be started, with #start


[View source]

Instance Method Detail

def bind #

Starting the FTP server, making clients able to connect and communicate with it


[View source]
def port : Int32 #

Port on which the server listen


[View source]
def root : String #

Path on which the server is mounted


[View source]
def start #

Starting the FTP server, making clients able to connect and communicate with it

NOTE The exection is launched in a fiber, so the rest of your program is not blocked

my_ftp_server.start
# From now, the server is accepting clients and handling them properly
sleep # Yield the execution

[View source]
def verbose_level=(level : Logger::Severity) #

Change the level of severity beyond which the logger of your FTPServer will print logs

NOTE When building in release mode, the severity is by default at Logger::ERROR. Otherwise, it is set by default at Logger::INFO


[View source]

Macro Detail

macro default_severity_level #

[View source]