FtpSession constructor

FtpSession(
  1. Socket controlSocket, {
  2. String? username,
  3. String? password,
  4. required FileOperations fileOperations,
  5. required ServerType serverType,
  6. required LoggerHandler logger,
})

Creates an FTP session with the provided file operations backend.

fileOperations handles all file/directory logic (virtual, physical, or custom). serverType determines the mode (read-only or read and write). Optional parameters include username, password, and logger.

BREAKING CHANGE: sharedDirectories and startingDirectory are removed. All directory logic is now handled by the provided fileOperations.

Implementation

FtpSession(this.controlSocket,
    {this.username,
    this.password,
    required FileOperations fileOperations,
    required this.serverType,
    required this.logger})
    : fileOperations = fileOperations.copy(),
      commandHandler = FTPCommandHandler(controlSocket, logger) {
  sendResponse('220 Welcome to the FTP server');
  logger.generalLog('FtpSession created. Ready to process commands.');
  controlSocket.listen(processCommand, onDone: closeConnection);
}