---
name: "pcap_set_snaplen"
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_set_snaplen/3pcap"
---

# pcap\_set\_snaplen(3pcap)

set the snapshot length for a not-yet-activated capture handle

## NAME

pcap\_set\_snaplen - set the snapshot length for a not-yet-activated capture handle

## SYNOPSIS

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

**int pcap\_set\_snaplen(pcap\_t \*p, int snaplen);**

## DESCRIPTION

**pcap\_set\_snaplen**() **sets the snapshot length to be used on a capture handle when the handle** **is activated to** *snaplen*.

## RETURN VALUE

**pcap\_set\_snaplen**() **returns** **0** **on success or** **PCAP\_ERROR\_ACTIVATED** **if called on a capture handle that has been activated.**

## SEE ALSO

**pcap**(3PCAP), **pcap\_create**(3PCAP), **pcap\_activate**(3PCAP)
