> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/accf_data.9.md).

# accf\_data.9

`accf_data` — 缓冲传入连接直到数据到达

## 名称

`accf_data`

## 概要

```sh
options INET
options ACCEPT_FILTER_DATA
```

在 **rc.conf(5)** 中：

```sh
kld_list="accf_data"
```

## 描述

这是一个放置在 socket 上的过滤器，该 socket 将使用 accept 来接收传入连接。

它阻止应用程序通过 accept 接收已连接的描述符，直到连接上有数据到达。

`ACCEPT_FILTER_DATA` 内核选项同时也是一个模块，如果 INET 选项已编译进内核，则可在运行时通过 [kldload(8)](/man/man8/kldload.8.md) 启用。

## 实例

假设 ACCEPT\_FILTER\_DATA 已包含在内核配置文件中，或者 `accf_data` 模块已加载，以下代码将在 socket `sok` 上启用 data 接受过滤器。

```c
struct accept_filter_arg afa;
bzero(&afa, sizeof(afa));
strcpy(afa.af_name, "dataready");
setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
```

## 参见

setsockopt(2), [accept\_filter(9)](/man/man9/accept_filter.9.md), [accf\_dns(9)](/man/man9/accf_dns.9.md), [accf\_http(9)](/man/man9/accf_http.9.md)

## 历史

接受过滤器机制和 accf\_data 过滤器引入于 FreeBSD 4.0。

## 作者

本手册页及过滤器由 Alfred Perlstein 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/accf_data.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
