[prev in list] [next in list] [prev in thread] [next in thread] 

List:       winpcap-users
Subject:    Re: [Winpcap-users] Real time sending packets
From:       "Gianluca Varenni" <gianluca.varenni () cacetech ! com>
Date:       2008-10-29 18:28:37
Message-ID: 3550AC51458F485199214E228A1EF77D () nelson2
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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@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@winpcap.org
    https://www.winpcap.org/mailman/listinfo/winpcap-users





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


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


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16735" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px">  <DIV style="FONT: 10pt arial">----- Original Message \
----- </DIV>  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=carlomedas@gmail.com href="mailto:carlomedas@gmail.com">Carlo 
  Medas</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org 
  href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, October 23, 2008 11:41 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Winpcap-users] Real time 
  sending packets</DIV>
  <DIV><BR></DIV>Dear Lesher,
  <DIV><BR></DIV>
  <DIV>please take my answer until Gianluca or some other guru officially 
  answers you.</DIV>
  <DIV><BR></DIV>
  <DIV>I've been doing something like you and I use a single pcap session with 
  success. Tested on Linux, Windows and Mac.</DIV>
  <DIV><BR></DIV>
  <DIV>Br,</DIV>
  <DIV><BR></DIV>
  <DIV>\Carlo<BR><BR>
  <DIV class=gmail_quote>On Thu, Oct 23, 2008 at 6:33 PM, <SPAN dir=ltr>&lt;<A 
  href="mailto:ceo@triplebit.com">ceo@triplebit.com</A>&gt;</SPAN> wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I \
  want to inject UDP packets to the interface in real time. In other words, 
    the program should run endlessly,capturing &nbsp;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.<BR>What is the most aprroprite 
    function for that- the users guide speaks about pcap_sendpacket and 
    pcap_sndqueue_transmit?<BR><BR>Another question-<BR>Does the open function, 
    pcap_open should be called once or twice(once again for the packet send) for 
    the above procedure?<BR><BR>I. 
    Lesher<BR><BR><BR><BR>_______________________________________________<BR>Winpcap-users \
  mailing list<BR><A href="mailto:Winpcap-users@winpcap.org" 
    target=_blank>Winpcap-users@winpcap.org</A><BR><A 
    href="https://www.winpcap.org/mailman/listinfo/winpcap-users" 
    target=_blank>https://www.winpcap.org/mailman/listinfo/winpcap-users</A><BR></BLOCKQUOTE></DIV><BR></DIV>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Winpcap-users 
  mailing 
  list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>




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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic