---
name: "ne_read_response_to_fd"
section: "3"
platform: "linux"
package: "neon"
version: "0.37.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ne_read_response_to_fd"
---

# ne\_read\_response\_to\_fd(3)

read a response body

## NAME

ne\_read\_response\_to\_fd, ne\_read\_response\_to\_buffer - read a response body

## SYNOPSIS

```
#include <ne_request.h>
```

**int ne\_read\_response\_to\_fd(ne\_request \****req***, int** *fd***);**

**int ne\_read\_response\_to\_buffer(ne\_request \****req***, char \****data***, size\_t \****buflen***);**

## DESCRIPTION

To read an HTTP response body the functions **ne\_read\_response\_to\_fd** and **ne\_read\_response\_to\_buffer** can be used. These functions are wrappers for **ne\_read\_response\_block** and must be called only after **ne\_begin\_request** has been called successfully for the request.

The **ne\_read\_response\_to\_fd** function writes the response body content to the file descriptor passed as the *fd* parameter.

The **ne\_read\_response\_to\_buffer** function writes the response body content to the buffer passed as the *buf* parameter, which has length passed via the \**buflen* parameter. On success, the \**buflen* is updated with the number of bytes written to the buffer.

After the response body has been read successfully, **ne\_end\_request** must be called. If a failure occurs while reading the response body, the connection must be closed using [**ne\_close\_connection**(3)](/ne_close_connection/3.md).

## RETURN VALUE

Both functions return zero on success, or an NE\_\* error code on failure. The **ne\_read\_response\_to\_buffer** function returns NE\_FAILED if the response message length is larger than the buffer length.

## HISTORY

**ne\_read\_response\_to\_buffer** is available in neon 0.36.0 and later.

## SEE ALSO

[**ne\_request\_create**(3)](/ne_request_create/3.md), [**ne\_set\_error**(3)](/ne_set_error/3.md)

## COPYRIGHT

Copyright © 2001-2026 Joe Orton\
