enterActiveMode method

Future<void> enterActiveMode(
  1. String parameters
)

Implementation

Future<void> enterActiveMode(String parameters) async {
  try {
    List<String> parts = parameters.split(',');
    String ip = parts.take(4).join('.');
    int port = int.parse(parts[4]) * 256 + int.parse(parts[5]);
    dataSocket = await Socket.connect(ip, port);
    sendResponse('200 Active mode connection established');
  } catch (e) {
    sendResponse('425 Can\'t enter active mode');
    logger.generalLog('Error entering active mode: $e');
  }
}