[Winpcap-users] my packets sent with winpcap can't reach NIC interface

Sunil Kumar badboy16a at gmail.com
Sun May 29 12:48:39 PDT 2011


may be its being discarded by NIC driver. better check structure of packet.
I have faced similar problem.

On Sat, May 28, 2011 at 9:34 PM, Nawel Souissi <nawelsouissi at yahoo.fr>wrote:

> 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?
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
>


-- 
Your smile is the most precious thing that doesn't cost you. Keep smiling.
:)
===============
     SunilKumar
------------------------------
http://in.linkedin.com/in/sunilkr86/
===============
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winpcap.org/pipermail/winpcap-users/attachments/20110530/e8a3450f/attachment.html>


More information about the Winpcap-users mailing list