enterPassiveMode method

Future<void> enterPassiveMode()

Implementation

Future<void> enterPassiveMode() async {
  dataListener = await ServerSocket.bind(InternetAddress.anyIPv4, 0);
  int port = dataListener!.port;
  int p1 = port >> 8;
  int p2 = port & 0xFF;
  // String address = controlSocket.address.address.replaceAll('.', ',');
  // I'm not sure what happened here, the client shows nothing if I comment out this line.
  // await Future.delayed(const Duration(microseconds: 0));
  var address = (await _getIpAddress()).replaceAll('.', ',');
  sendResponse('227 Entering Passive Mode ($address,$p1,$p2)');
  dataListener!.first.then((socket) {
    dataSocket = socket;
    // sendResponse('227 Entering Passive Mode ($address,$p1,$p2)');
  });
}