[Winpcap-users] my packets sent with winpcap can't reach NIC interface
Nawel Souissi
nawelsouissi at yahoo.fr
Sat May 28 09:04:10 PDT 2011
Hello,
i'am using winpcap in my project.
i want to send packets from one computer to another computer.
i
developped a transmitter application that uses winpcap to send packets
to my NIC interface, and a receiver application that capture packets
from NIC interface in another computer using winpcap.
the two cards are related with a cross wire.
but
i have a problem here: the transmitter application prints "Packet is
sent" but my receiver doesn't receive this packet (that i have sent)!!
i tested the receiver application and it works well if i relate it with another network.
the connexion between two cards is working well also i tested it with ping.
i
even tried with wireshark, i sent a packet to my NIC interface and i
started wireshark (installed in the same computer) and i want him to
capture from this NIC interface but he prints "no packets". means that
packets are dropped before reaching the Ethernet card!!
i really need your help!! why my packets can't reach my Ethernet card?
this is my transmitter code:
pcap_if_t* ChosenDevice;
pcap_t *fp;
const char *InterfaceName;
char errbuf[PCAP_ERRBUF_SIZE];
int i = 1;
pcap_findalldevs_ex(PCAP_SRC_IF_STRING,NULL,&ChosenDevice,errbuf);
for(pcap_if_t* CurrentDevice = ChosenDevice;CurrentDevice != NULL;CurrentDevice = CurrentDevice->next)
{
cout<<i << ". "<< CurrentDevice->description << endl;
i++;
}
int chosen;
cin >> chosen;
if ( (fp= pcap_open(ChosenDevice->name,
1500,
PCAP_OPENFLAG_PROMISCUOUS,
1000, // read timeout
NULL, // authentication on the remote machine
errbuf //
error buffer
) ) == NULL)
{
fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n", InterfaceName);
}
if(pcap_sendpacket(fp,Frame,Framesize)==0)
cout<<"packet is sent"<<endl;
and i used these functions is my receiver code:
pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf);
pcap_handle=pcap_open_live(d->name,20480,1,0,errbuf);
pcap_next_ex( pcap_handle, &paquet_header, &Paquet_Ethernet);
i think that i have a problem with some parameter in winpcap functions.
so how can i solve my
problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winpcap.org/pipermail/winpcap-users/attachments/20110528/dbbf3f92/attachment.html>
More information about the Winpcap-users
mailing list