[Winpcap-users] problem with pcap_packetsend

Horatio horatio at rtlab.cs.nthu.edu.tw
Wed Nov 1 13:36:07 GMT 2006

Hi there mailinglist,

I am a newbie and I have a problem with the function,
"pcap_packetsend(pcap_t *p,u_char *buf,int size)"

It return -1(error) if the packet size is larger than roughly 1500 bytes.
I tried to solve this problem by using "pcap_setbuff" and
"pcap_setuserbuffer", but it still doesn't work.
I use Wireshark to observe the packets, and I thought that packets' size
is cause of this error.

I am working on a NAT server.
I access to internet on a PPPoE connection. I "open" the REAL ethernet
adapter as the first argument in
pcap_packetsend(pcap_t *p....
I add the PPPoE/PPP header to packets, and call pcap_packetsend to send it.
It does work. So far, In the computer with a private IP, I can use
telnet to connect the computer in Internet
through my NAT server.

My system : WinXP_SP2 + WinPcap 3.1 + Visual Studio C++ 2005

By the way, does anybody have any suggestions in developing a NAT server?
(a term project of a course, not a commercial product.)
Should I use Socket API to deal with the connection between NAT and

Forgive me my poor English.
Thank you very much!

More information about the Winpcap-users mailing list