PCAP\_FILENO(3PCAP) PCAP\_FILENO(3PCAP)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

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

```
int pcap_fileno(pcap_t *p);
```

# [DESCRIPTION](#DESCRIPTION)

If *p* refers to a network device that was opened for a live capture using a combination of [**pcap\_create**(3PCAP)](/man/os/libpcap/pcap_create.3PCAP) and [**pcap\_activate**(3PCAP)](/man/os/libpcap/pcap_activate.3PCAP), or using [**pcap\_open\_live**(3PCAP)](/man/os/libpcap/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)](/man/os/libpcap/pcap_open_offline.3PCAP) or [**pcap\_fopen\_offline**(3PCAP)](/man/os/libpcap/pcap_fopen_offline.3PCAP), a \`\`dead'' **pcap\_t** opened using [**pcap\_open\_dead**(3PCAP)](/man/os/libpcap/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](#SEE_ALSO)

[**pcap**(3PCAP)](/man/os/libpcap/pcap.3PCAP)

25 July 2018

---

Document: pcap_fileno(3pcap) from libpcap 1.11.0-r0 (Chainguard OS)
Source: https://github.com/the-tcpdump-group/libpcap.git
