---
name: "pcap_fileno"
section: "3pcap"
platform: "linux"
package: "libpcap"
version: "1.11.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_fileno/3pcap"
---

# pcap\_fileno(3pcap)

get the file descriptor for a live capture

## NAME

pcap\_fileno - get the file descriptor for a live capture

## SYNOPSIS

```
#include <pcap/pcap.h>
```

**int pcap\_fileno(pcap\_t \*p);**

## DESCRIPTION

If *p* refers to a network device that was opened for a live capture using a combination of **pcap\_create**(3PCAP) and **pcap\_activate**(3PCAP), or using **pcap\_open\_live**(3PCAP), **pcap\_fileno**() returns the file descriptor from which captured packets are read.

If *p* refers to a \`\`savefile'' that was opened using functions such as **pcap\_open\_offline**(3PCAP) or **pcap\_fopen\_offline**(3PCAP), a \`\`dead'' **pcap\_t** opened using **pcap\_open\_dead**(3PCAP), or a **pcap\_t** that was created with **pcap\_create**() but that has not yet been activated with **pcap\_activate**(), it returns **PCAP\_ERROR**.

## SEE ALSO

**pcap**(3PCAP)
