---
name: "pcap_set_snaplen"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pcap_set_snaplen"
---

# pcap\_set\_snaplen(3)

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**(3)](/pcap/3.md), [**pcap\_create**(3)](/pcap_create/3.md), [**pcap\_activate**(3)](/pcap_activate/3.md)
