<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 72.0pt 72.0pt 72.0pt; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
H1 {
        FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 1 Char"
}
H2 {
        FONT-SIZE: 14pt; MARGIN: 12pt 0cm 3pt; FONT-STYLE: italic; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 2 Char"
}
H3 {
        FONT-SIZE: 13pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 3 Char"
}
H4 {
        FONT-SIZE: 14pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 4 Char"
}
H5 {
        FONT-SIZE: 13pt; MARGIN: 12pt 0cm 3pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 5 Char"
}
H6 {
        FONT-SIZE: 11pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 6 Char"
}
P.MsoHeading7 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 7 Char"
}
LI.MsoHeading7 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 7 Char"
}
DIV.MsoHeading7 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 7 Char"
}
P.MsoHeading8 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 8 Char"
}
LI.MsoHeading8 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 8 Char"
}
DIV.MsoHeading8 {
        FONT-SIZE: 12pt; MARGIN: 12pt 0cm 3pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 9; mso-style-link: "Heading 8 Char"
}
P.MsoHeading9 {
        FONT-SIZE: 11pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 9 Char"
}
LI.MsoHeading9 {
        FONT-SIZE: 11pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 9 Char"
}
DIV.MsoHeading9 {
        FONT-SIZE: 11pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 9 Char"
}
P.MsoCaption {
        FONT-WEIGHT: bold; FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; COLOR: #4f81bd; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 35
}
LI.MsoCaption {
        FONT-WEIGHT: bold; FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; COLOR: #4f81bd; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 35
}
DIV.MsoCaption {
        FONT-WEIGHT: bold; FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; COLOR: #4f81bd; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 35
}
P.MsoTitle {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 10; mso-style-link: "Title Char"
}
LI.MsoTitle {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 10; mso-style-link: "Title Char"
}
DIV.MsoTitle {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 10; mso-style-link: "Title Char"
}
P.MsoSubtitle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 11; mso-style-link: "Subtitle Char"
}
LI.MsoSubtitle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 11; mso-style-link: "Subtitle Char"
}
DIV.MsoSubtitle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 3pt; FONT-FAMILY: "Cambria","serif"; TEXT-ALIGN: center; mso-style-priority: 11; mso-style-link: "Subtitle Char"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
EM {
        FONT-WEIGHT: bold; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 20
}
P.MsoNoSpacing {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 1
}
LI.MsoNoSpacing {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 1
}
DIV.MsoNoSpacing {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 1
}
P.MsoListParagraph {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34
}
LI.MsoListParagraph {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34
}
DIV.MsoListParagraph {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34
}
P.MsoListParagraphCxSpFirst {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
LI.MsoListParagraphCxSpFirst {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
DIV.MsoListParagraphCxSpFirst {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
P.MsoListParagraphCxSpMiddle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
LI.MsoListParagraphCxSpMiddle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
DIV.MsoListParagraphCxSpMiddle {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
P.MsoListParagraphCxSpLast {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
LI.MsoListParagraphCxSpLast {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
DIV.MsoListParagraphCxSpLast {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt 36pt; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 34; mso-style-type: export-only
}
P.MsoQuote {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 29; mso-style-link: "Quote Char"
}
LI.MsoQuote {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 29; mso-style-link: "Quote Char"
}
DIV.MsoQuote {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 29; mso-style-link: "Quote Char"
}
P.MsoIntenseQuote {
        FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0cm 36pt 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 30; mso-style-link: "Intense Quote Char"
}
LI.MsoIntenseQuote {
        FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0cm 36pt 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 30; mso-style-link: "Intense Quote Char"
}
DIV.MsoIntenseQuote {
        FONT-WEIGHT: bold; FONT-SIZE: 12pt; MARGIN: 0cm 36pt 0pt; FONT-STYLE: italic; FONT-FAMILY: "Calibri","sans-serif"; mso-style-priority: 30; mso-style-link: "Intense Quote Char"
}
SPAN.MsoSubtleEmphasis {
        COLOR: #5a5a5a; FONT-STYLE: italic; mso-style-priority: 19
}
SPAN.MsoIntenseEmphasis {
        FONT-WEIGHT: bold; FONT-STYLE: italic; TEXT-DECORATION: underline; mso-style-priority: 21
}
SPAN.MsoSubtleReference {
        TEXT-DECORATION: underline; mso-style-priority: 31
}
SPAN.MsoIntenseReference {
        FONT-WEIGHT: bold; TEXT-DECORATION: underline; mso-style-priority: 32
}
SPAN.MsoBookTitle {
        FONT-WEIGHT: bold; FONT-STYLE: italic; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 33
}
P.MsoTocHeading {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 39
}
LI.MsoTocHeading {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 39
}
DIV.MsoTocHeading {
        FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0cm 3pt; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 39
}
SPAN.Heading1Char {
        FONT-WEIGHT: bold; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 1"; mso-style-name: "Heading 1 Char"
}
SPAN.Heading2Char {
        FONT-WEIGHT: bold; FONT-STYLE: italic; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 2"; mso-style-name: "Heading 2 Char"
}
SPAN.Heading3Char {
        FONT-WEIGHT: bold; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 3"; mso-style-name: "Heading 3 Char"
}
SPAN.Heading4Char {
        FONT-WEIGHT: bold; FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 9; mso-style-link: "Heading 4"; mso-style-name: "Heading 4 Char"
}
SPAN.Heading5Char {
        FONT-WEIGHT: bold; FONT-STYLE: italic; FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 9; mso-style-link: "Heading 5"; mso-style-name: "Heading 5 Char"
}
SPAN.Heading6Char {
        FONT-WEIGHT: bold; FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 9; mso-style-link: "Heading 6"; mso-style-name: "Heading 6 Char"
}
SPAN.Heading7Char {
        FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 9; mso-style-link: "Heading 7"; mso-style-name: "Heading 7 Char"
}
SPAN.Heading8Char {
        FONT-STYLE: italic; FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 9; mso-style-link: "Heading 8"; mso-style-name: "Heading 8 Char"
}
SPAN.Heading9Char {
        FONT-FAMILY: "Cambria","serif"; mso-style-priority: 9; mso-style-link: "Heading 9"; mso-style-name: "Heading 9 Char"
}
SPAN.TitleChar {
        FONT-WEIGHT: bold; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 10; mso-style-link: Title; mso-style-name: "Title Char"
}
SPAN.SubtitleChar {
        FONT-FAMILY: "Cambria","serif"; mso-style-priority: 11; mso-style-link: Subtitle; mso-style-name: "Subtitle Char"
}
SPAN.QuoteChar {
        FONT-STYLE: italic; mso-style-priority: 29; mso-style-link: Quote; mso-style-name: "Quote Char"
}
SPAN.IntenseQuoteChar {
        FONT-WEIGHT: bold; FONT-STYLE: italic; mso-style-priority: 30; mso-style-link: "Intense Quote"; mso-style-name: "Intense Quote Char"
}
SPAN.EmailStyle45 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-GB vLink=purple link=blue bgColor=#ffffff>
<DIV><FONT size=2>Which capture filter do you use? Also, do you capture any
packet if you set promiscuous mode on (setting the promiscuous parameter of
pcap_open_live to 1)?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></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=ryan.fowler@thomsonreuters.com
href="mailto:ryan.fowler@thomsonreuters.com">Ryan Fowler</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> Tuesday, July 01, 2008 6:47
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] pcap_next_ex()
not receiving packets</DIV>
<DIV><BR></DIV>
<DIV class=Section1>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt">Hi,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 11pt">I am trying to
receive packets using pcap_next_ex(), but for some reason I keep getting a
timeout. I know that packets are coming into the machine because I can
see them via WinDump. The odd part is that when I run WinDump
concurrently with my test application, I start to see packets in the test app
(as well as in WinDump). But without WinDump, I get no packets on the
test app at all.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 11pt">I am guessing that
there is something I need to do to “start” the packet driver capturing,
although I thought that’s what pcap_open_live does, so I’m not quite sure on
that.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 11pt">My code so far is
a fairly liberal sampling of the pktdump_ex example:<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: green">/* Open the adapter */<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">if</SPAN> ((m_pSessionHandle =
pcap_open_live(m_pReceiveDevice->name, <SPAN
style="COLOR: green">// name of the device<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
65536, <SPAN style="COLOR: green">// 65536 means
the whole packet will be captured.<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
0, <SPAN style="COLOR: green">// non promiscuous mode
(nonzero means promiscuous)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
1000,
<SPAN style="COLOR: green">// read
timeout<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
errbuf <SPAN style="COLOR: green">// error
buffer</SPAN>)) == NULL)<SPAN
style="COLOR: green"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
// Error code<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
std::cout << <SPAN style="COLOR: #a31515">"Filter: "</SPAN> <<
m_strFilter << std::endl;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">if</SPAN> ( !m_strFilter.empty()
)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
bpf_u_int32 NetMask = 0;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">struct</SPAN> bpf_program
fcode;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: green">//compile the filter<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">if</SPAN>(pcap_compile(m_pSessionHandle, &fcode,
<SPAN style="COLOR: blue">const_cast</SPAN><<SPAN
style="COLOR: blue">char</SPAN>*>(m_strFilter.c_str()), 1, NetMask) <
0)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
// Error code<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: green">//set the
filter<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">if</SPAN>(pcap_setfilter(m_pSessionHandle,
&fcode)<0)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
// Error code<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: green">/* At this point, we don't need the device list any
more. Free it */<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
pcap_freealldevs(alldevs);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 11pt">And later
on:<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">while</SPAN>((res = pcap_next_ex( m_pSessionHandle,
&header, &pkt_data)) >= 0)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">if</SPAN>(res == 0)<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: green">/* Timeout elapsed */<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
OutputDebugString(L<SPAN style="COLOR: #a31515">"No
packets!\n"</SPAN>);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<SPAN style="COLOR: blue">continue</SPAN>;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt; TEXT-INDENT: 36pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">//…<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US
style="FONT-SIZE: 11pt"><o:p> </o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: silver 1pt dotted; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 4pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 9pt; COLOR: #666666; FONT-FAMILY: 'Arial','sans-serif'">Ryan
Fowler</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: 'Arial','sans-serif'"><BR></SPAN><SPAN
style="FONT-SIZE: 9pt; COLOR: #666666; FONT-FAMILY: 'Arial','sans-serif'">Software
Engineer</SPAN><SPAN
style="FONT-FAMILY: 'Times New Roman','serif'"><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-BOTTOM: 9pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; mso-margin-top-alt: 9.0pt"><B><SPAN
style="FONT-SIZE: 9pt; COLOR: #f57f20; FONT-FAMILY: 'Arial','sans-serif'">Thomson
Reuters</SPAN></B><SPAN style="FONT-FAMILY: 'Times New Roman','serif'">
<o:p></o:p></SPAN></P></DIV></DIV></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>