Ziara,<br><br>Couple of points/suggs:<br><br>- I'd follow GV's advice and look at the samples<br><br>- I believe the obsolete api you used returned a unicode string ; i.e. every other byte was 0 <br> hence, the single character for the name. Plus there is a good chance it might return
<br> "Generic Dialup Adapter" which wouldn't have been much use; <br> In short, pcap_findalldevs is a better way to go.<br><br>- Note: you were also using a WinSock api and although it wasn't necessary for this
<br> app/api, it is probably a good idea to initialize WinSock via WSAStartup() and WSACleanup.<br><br>good luck. <br><br>John<br><br><div class="gmail_quote">On Nov 28, 2007 12:40 PM, Gianluca Varenni <<a href="mailto:gianluca.varenni@cacetech.com">
gianluca.varenni@cacetech.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Courier New">I suggest you to take out of the samples from the
winpcap developer's pack.</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">You are using pcap_lookupdev, which is obsolete
(and on Windows it doesn't have the same semantics of pcap_lookupdev undex
Unix).</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Please use pcap_findalldevs to get the list of
adapters.</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Have a nice day</font></div>
<div><font face="Courier New">GV</font></div>
<div> </div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><div><div></div><div class="Wj3C7c">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="essence_z@hotmail.com" href="mailto:essence_z@hotmail.com" target="_blank">Ziara .</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="winpcap-users@winpcap.org" href="mailto:winpcap-users@winpcap.org" target="_blank">
winpcap</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Tuesday, November 27, 2007 1:49
PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> [Winpcap-users] Trying a
example</div>
<div><br></div>Hi! I'm trying other example in Builder c++, someone can tell
me why this code doesn't work? what is it wrong?<br> <br>int main(int
argc, char **argv)<br>{<br>char *net; // direccion de red<br>char *mask; //
mascara de subred<br>char *dev; // nombre del dispositivo de red<br>int ret;
// codigo de retorno<br>char errbuf[PCAP_ERRBUF_SIZE]; // buffer para mensajes
de error<br>bpf_u_int32 netp; // direcion de red en modo raw<br>bpf_u_int32
maskp; // mascara de red en modo raw<br>struct in_addr addr;<br>if ((dev =
pcap_lookupdev(errbuf))== NULL) //conseguimos la primera interfaz
libre<br>{<br> printf("ERROR
%s\n",errbuf);<br>
exit(-1);<br>}<br>printf("Nombre del dispositivo: %s\n",dev); //mostramos el
nombre del dispositivo<br>if ((ret =
pcap_lookupnet(dev,&netp,&maskp,errbuf))==-1) //consultamos las
direccion de red y las
mascara<br>{<br> printf("ERROR
%s\n",errbuf);<br>
exit(-1);<br>}<br>addr.s_addr = netp; //Traducimos la direccion de red a algo
legible<br>if ((net =
inet_ntoa(addr))==NULL)<br>{<br>
perror("inet_ntoa");<br>
exit(-1);<br>}<br>printf("Direccion de Red: %s\n",net);<br>addr.s_addr =
maskp; //Idem para la mascara de subred<br>mask = inet_ntoa(addr);<br>if
((net=inet_ntoa(addr))==NULL)<br>{<br>
perror("inet_ntoa");<br>
exit(-1);<br>}<br>printf("Mascara de Red: %s\n",mask);<br>return
0;<br>}<br> <br>when and build and run the .exe, only
appear:<br> <br>Nombre del dispostivo: /<br>Direccion de Red:
<a href="http://0.0.0.0" target="_blank">0.0.0.0</a><br>Mascara de Red: <a href="http://0.0.0.0" target="_blank">0.0.0.0</a><br> <br>thanks<br><br>
<hr>
Tecnología, moda, motor, viajes,…suscríbete a nuestros boletines para estar a
la última <a href="http://newsletters.msn.com/hm/maintenanceeses.asp?L=ES&C=ES&P=WCMaintenance&Brand=WL&RU=http%3a%2f%2fmail.live.com" target="_blank">MSN Newsletters</a>
</div></div><p>
</p><hr>
<p></p>_______________________________________________<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>_______________________________________________<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" target="_blank">
https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br><br></blockquote></div><br>