---
name: "pcap_set_timeout"
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_timeout"
---

# pcap\_set\_timeout(3)

set the packet buffer timeout for a not-yet-activated capture handle

## NAME

pcap\_set\_timeout - set the packet buffer timeout for a not-yet-activated capture handle

## SYNOPSIS

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

**int pcap\_set\_timeout(pcap\_t \*p, int to\_ms);**

## DESCRIPTION

**pcap\_set\_timeout**() **sets the packet buffer timeout that will be used on a capture handle** **when the handle is activated to** *to\_ms*, **which is in units of milliseconds.  (See** [**pcap**(3)](/pcap/3.md) **for an explanation of the packet buffer timeout.)**

**The behavior, if the timeout isn't specified, is undefined, as is the** **behavior if the timeout is set to zero or to a negative value.  We** **recommend always setting the timeout to a non-zero value unless** **immediate mode is set, in which case the timeout has no effect.**

## RETURN VALUE

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

## SEE ALSO

[**pcap\_create**(3)](/pcap_create/3.md), [**pcap\_activate**(3)](/pcap_activate/3.md), **pcap\_set\_immediate\_mode**(3)
