Yeah I saw Bryan's reply, but adding those services (npf, nm) to my service's depnedons mutli-string value didn't produce any different results.<br><br>
<div><span class="gmail_quote">On 3/28/06, <b class="gmail_sendername">Guy Harris</b> &lt;<a href="mailto:guy@alum.mit.edu">guy@alum.mit.edu</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>On Mar 28, 2006, at 1:00 PM, matt jaffa wrote:<br><br>&gt; I was wondering if how I was first initially using winpcap is the
<br>&gt; correct way of doing it.<br>&gt; So I am looking up all the devices then creating a thread for each<br>&gt; device to listen for packets on.<br>&gt; Does this code look right?<br><br>Not entirely - see below.<br>
<br>&gt; if(pcap_findalldevs(&amp;alldevs, errbuf) == -1)&nbsp;&nbsp;&nbsp;&nbsp;// This is where it<br>&gt; hangs when are program is a service<br><br>Did you see Bryan Kadzban's reply?<br><br>&gt; char *deviceName = new char[256];<br>&gt; sprintf(deviceName, &quot;%s&quot;, d-&gt;name);
<br>This assumes that the device name fits in 256 characters.&nbsp;&nbsp;That's<br>probably true, so it's probably not causing problems in your code,<br>but, as a general programming practice, it's unsafe.<br><br>Also, the &quot;sprintf&quot; is overkill, as all you're doing is copying the
<br>string.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *Devicename = strdup(d-&gt;name);<br><br>would suffice.</blockquote>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>I did have something similar to that way before, but I was noticing as I was passing the pointer to the thread the name of the device was being corrupted. I never did use the strdup call though, maybe that would solve that problem and can get rid of the set size of 256.
</div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>Matt</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">_______________________________________________<br>Winpcap-users mailing list<br><a href="mailto:Winpcap-users@winpcap.org">
Winpcap-users@winpcap.org</a><br><a href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br></blockquote></div><br>