How to programmatically write IP packet bytes into PCAP file format?

lai*_*ech 6 c java networking

Assuming that I have a set of buffers that represents an IP packet, how can generate a PCAP file? I'm looking for an API to do this in C/C++ or Java.

and*_*oke 8

jnetpcap包括类PcapDumper作为将写入字节的阵列以一个PCAP文件记录在这里.

[原始提问者注意:这个答案被低估了,因为我回答了你的问题,并批评别人提出了一个合理的问题,而不是因为答案实际上是错误的]