@Override
  public void execute(final FunctionContext<NetstatFunctionArgument> context) {
    DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
    if (ds == null || !ds.isConnected()) {
      return;
    }

    String host = ds.getDistributedMember().getHost();
    NetstatFunctionArgument args = context.getArguments();
    boolean withlsof = args.isWithlsof();
    String lineSeparator = args.getLineSeparator();

    String netstatOutput = executeCommand(lineSeparator, withlsof);

    StringBuilder netstatInfo = new StringBuilder();

    // {0} will be replaced on Manager
    addMemberHostHeader(netstatInfo, "{0}", host, lineSeparator);

    NetstatFunctionResult result = new NetstatFunctionResult(host, netstatInfo.toString(),
        CliUtils.compressBytes(netstatOutput.getBytes()));

    context.getResultSender().lastResult(result);
  }
Executes 'netstat' OS command & returns the result as compressed bytes.

@since GemFire 7.0
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/functions/NetstatFunction.java