Server Module#

The server module contains the main FTP server implementation.

Server module for thinFTP.

This module defines the threaded TCP server for the FTP service. It uses Python’s built-in socketserver.ThreadingTCPServer to handle multiple client connections concurrently.

class thinftp.server.ThreadedThinFTP(addr, handler, config)[source]#

Bases: ThreadingTCPServer

A threaded FTP server class for handling multiple client connections.

config#

A configuration object containing server settings.

Type:

Namespace

lgr#

Logger instance used for logging server events.

Type:

logging.Logger

daemon_threads = True#
__init__(addr, handler, config)[source]#

Initialize the threaded FTP server.

Parameters:
  • addr (tuple) – (host, port) address tuple to bind the server.

  • handler (BaseRequestHandler) – Handler class for processing requests.

  • config (Namespace) – Configuration object with server parameters.

thinftp.server.start_server(config)[source]#

Start and run the FTP server using the provided configuration.

This function binds the server to the given host and port, logs startup information, and enters the request-handling loop.

Parameters:

config (Namespace) – Configuration object containing: - bind (str): IP address to bind the server. - port (int): Port to listen on. - user (str): FTP username. - pswd (str): FTP password. - directory (str): Directory to serve. - lgr (Logger): Preconfigured logger instance.

ThreadedThinFTP Class#

class thinftp.server.ThreadedThinFTP(addr, handler, config)[source]#

Bases: ThreadingTCPServer

A threaded FTP server class for handling multiple client connections.

config#

A configuration object containing server settings.

Type:

Namespace

lgr#

Logger instance used for logging server events.

Type:

logging.Logger

daemon_threads = True#
__init__(addr, handler, config)[source]#

Initialize the threaded FTP server.

Parameters:
  • addr (tuple) – (host, port) address tuple to bind the server.

  • handler (BaseRequestHandler) – Handler class for processing requests.

  • config (Namespace) – Configuration object with server parameters.