[Winpcap-users] pcap_sendpacket async or sync behaviour?

Carlo Medas carlomedas at gmail.com
Wed Oct 1 07:44:58 GMT 2008


Dear Gianluca,
thank you very much.
But does this also means that it could be dangerous to have a pcap session
used concurrently by one thread which is running pcap_loop(...,-1...); and
another thread which is periodically doing pcap_sendpacket ?

Ciao and thanks for your precious support,

\Carlo

On Wed, Oct 1, 2008 at 12:40 AM, Gianluca Varenni <
gianluca.varenni at cacetech.com> wrote:

>  Not completely. The problem is that the error buffer used internally in
> the pcap_t handle is not per_thread. So if two threads try to transmit on
> the same pcap_t handle and they both fail, you might get garbage in the
> error message string returned by pcap_geterror.
>
> Have a nice day
> GV
>
> ----- Original Message -----
> *From:* Carlo Medas <carlomedas at gmail.com>
> *To:* winpcap-users at winpcap.org
> *Sent:* Sunday, September 28, 2008 6:45 AM
> *Subject:* Re: [Winpcap-users] pcap_sendpacket async or sync behaviour?
>
> Dear Gianluca,
> another question regarding pcap_sendpacket: is it multithread safe?
> I mean, can I concurrently call pcap_sendpacket on a same capture session
> handle from multiple threads without the need of external synchronisation?
>
> Thanks in advance, your advices are very precious.
>
> Ciao,
>
> \Carlo
>
> On Fri, Sep 26, 2008 at 9:00 AM, Carlo Medas <carlomedas at gmail.com> wrote:
>
>> Dear Gianluca,
>> thanks for your more than exaustive answer. The way it works sounds great
>> for any need, moreover for my needs (network monitoring).
>>
>> Thanks and ciao,
>>
>> \Carlo
>>
>>
>> On Thu, Sep 25, 2008 at 8:30 PM, Gianluca Varenni <
>> gianluca.varenni at cacetech.com> wrote:
>>
>>>  Carlo,
>>> pcap_sendpacket is basically sync, i.e. it passes the packet to be
>>> transmitted to the underlying miniport controlling the NIC, and it waits for
>>> such miniport to return. However, the miniport might decide to return
>>> success even if the packet has been scheduled to be transmitted (i.e. it's
>>> in some transmit queue) but has not actually been transmitted yet.
>>>
>>> Does it make any sense to you?
>>>
>>> Have a nice day
>>> GV
>>>
>>>   ----- Original Message -----
>>> *From:* Carlo Medas <carlomedas at gmail.com>
>>> *To:* winpcap-users at winpcap.org
>>> *Sent:* Wednesday, September 24, 2008 10:09 AM
>>> *Subject:* [Winpcap-users] pcap_sendpacket async or sync behaviour?
>>>
>>> Dear all,
>>> sorry for newbie question but... I was wondering if pcap_sendpacket is
>>> sync or async.
>>>
>>> If it's async, do I get a special error reported?
>>> If it's sync, I suppose that it would block until my packet has been
>>> sent?
>>>
>>> Thank you in advance.
>>>
>>> Best regards,
>>>
>>> \Carlo Medas
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>  ------------------------------
>
> _______________________________________________
> 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/20081001/6e07391e/attachment.htm


More information about the Winpcap-users mailing list