pcap_geterr Subroutine

Purpose

Obtains the most recent pcap error message.

Library

pcap Library (libpcap.a)

Syntax

#include <pcap.h>

char *pcap_geterr(pcap_t * p);

Description

The pcap_geterr subroutine returns the error text pertaining to the last pcap library error. This subroutine is useful in obtaining error text from those subroutines that do not return an error string. Since the pointer returned points to a memory space that will be reused by the pcap library subroutines, it is important to copy this message into a new buffer if the error text needs to be saved.

Parameters

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

Return Values

The pcap_geterr subroutine returns a pointer to the most recent error message from a pcap library subroutine. If there were no previous error messages, a string with 0 as the first byte is returned.