[Winpcap-users] Real time sending packets

Gianluca Varenni gianluca.varenni at cacetech.com
Wed Oct 29 18:28:37 GMT 2008


You can definitely use the same pcap_t instance to send and transmit at the same time, with one caveat: if you use the same pcap_t handle from two different threads (e.g. one that receives and one that transmits), then you need to provide the necessary synchronization around the pcap_t handle.

Regarding pcap_sendpacket vs sendqueue_transmit, it depends on your requirements. If you need to transfer one packet at a time, the you want to use pcap_sendpacket. If you can batch packets and transmit them all together, I would think of using the sendqueue functions.

Have a nice day
GV

  ----- Original Message ----- 
  From: Carlo Medas 
  To: winpcap-users at winpcap.org 
  Sent: Thursday, October 23, 2008 11:41 PM
  Subject: Re: [Winpcap-users] Real time sending packets


  Dear Lesher,


  please take my answer until Gianluca or some other guru officially answers you.


  I've been doing something like you and I use a single pcap session with success. Tested on Linux, Windows and Mac.


  Br,


  \Carlo


  On Thu, Oct 23, 2008 at 6:33 PM, <ceo at triplebit.com> wrote:

    I want to inject UDP packets to the interface in real time. In other words, the program should run endlessly,capturing  the interface and for every input packet(with the right filter), it should establish a packet from this data and send it again to a third address.
    What is the most aprroprite function for that- the users guide speaks about pcap_sendpacket and pcap_sndqueue_transmit?

    Another question-
    Does the open function, pcap_open should be called once or twice(once again for the packet send) for the above procedure?

    I. Lesher



    _______________________________________________
    Winpcap-users mailing list
    Winpcap-users at winpcap.org
    https://www.winpcap.org/mailman/listinfo/winpcap-users





------------------------------------------------------------------------------


  _______________________________________________
  Winpcap-users mailing list
  Winpcap-users at winpcap.org
  https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20081029/417db24f/attachment.htm


More information about the Winpcap-users mailing list