<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<STYLE>.hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY class=hmmessage 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="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=essence_z@hotmail.com href="mailto:essence_z@hotmail.com">Ziara .</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, November 27, 2007 1:49
PM</DIV>
<DIV style="FONT: 10pt arial"><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:
0.0.0.0<BR>Mascara de Red: 0.0.0.0<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=_new>MSN Newsletters</A>
<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>