TcpScannerTask constructor
TcpScannerTask(})
Implementation
TcpScannerTask(this.host, List<int> ports,
{this.socketTimeout = const Duration(seconds: 1), this.shuffle = false, int parallelism = 4}) {
if (ports.isEmpty) {
throw TcpScannerTaskException('Ports list is empty');
} else if (parallelism < 1) {
throw TcpScannerTaskException('\'parallelism\' should be a positive number');
} else if (ports.any((port)=> port < 0 || 65535 < port )) {
throw TcpScannerTaskException('Some port is out of range 0-65535');
}
// Copy ports list and shuffle them if it's needed
var portsList = ports.toSet().toList();
if (shuffle) portsList.shuffle();
this.ports = portsList;
// Calculate number of isolates. The number of isolates can't be more than the number of ports.
this.parallelism = min(parallelism, ports.length);
}