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

# pcap\_set\_timeout(3pcap)

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**(3PCAP) **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**(3PCAP), **pcap\_activate**(3PCAP), **pcap\_set\_immediate\_mode**(3PCAP)
