Firstly, The paper introduces the principle of sniffer technology to capture data packets, illustrates the structure and functions of libpcap library and winpcap(the windows version of libpcap) based on BPF and presents the design of packet capture class.