acceptAddressOnTCPPort method

Future<bool> acceptAddressOnTCPPort(
  1. String address,
  2. int port
)

Adds a rule to accept a TCP connection from a specified address to the blocked port.

Parameters:

  • address: The IP address or hostname to accept connections from.
  • port: The port number to allow access to.

Returns: A Future<bool> that resolves to true if successful, or false if the rule could not be added.

Implementation

Future<bool> acceptAddressOnTCPPort(String address, int port) async {
  address = address.trim();
  if (address.isEmpty) return false;
  var response = await _sendCommand("accept $address $port");
  return response?.contains('true') ?? false;
}