pcap_close Subroutine

Purpose

Closes the open files related to the packet capture descriptor and frees the memory used by the packet capture descriptor.

Library

pcap Library (libpcap.a)

Syntax

#include <pcap.h>

void pcap_close(pcap_t * p);

Description

The pcap_close subroutine closes the files associated with the packet capture descriptor and deallocates resources. If the pcap_open_offline subroutine was previously called, the pcap_close subroutine closes the savefile, a previously saved packet capture data file. Or the pcap_close subroutine closes the packet capture device if the pcap_open_live subroutine was previously called.

Parameters

Item Description
p Points to a packet capture descriptor as returned by the pcap_open_live or the pcap_open_offline subroutine.