FtpSession constructor
FtpSession(
- Socket controlSocket, {
- String? username,
- String? password,
- required FileOperations fileOperations,
- required ServerType serverType,
- 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);
}