envoie de plusieurs paquets Ethernet simultanément


Bonsoir,

je suis entrain de développer une application sous visual C++ 2010.
mais j'ai un problème,j'espère que je trouve une réponse dans ce forum.

je dois envoyer plusieurs paquets Ethernet simultanément de la couche application vers la couche physique (bien sur ça passe par les étapes de construction des paquets dans les couches UDP,IP,MAC)

je pense que c'est possible, si oui comment? c'est très urgent,j'ai besoin de cette information pour mon projet.
svp si quelqu'un d'entre vous peut m'aider.

Merci d'avance.
you can try asynchronous socket programming if you are using .Net

here are links for C#, but it should be easy to translate to managed C++

http://www.codeproject.com/KB/IP/asyncsockets.aspx
http://www.codeguru.com/csharp/csharp/cs_network/sockets/article.php/c7695

bonne chance!
Thank you so much, but i thought that i can't use sockets for my application. sockets are not used only for communication between two hosts?

in my case i want to send many packets simultaneously from application layer to physical layer. and in physical layer,there is scheduler (MUX) that will arrange all packets in the same line to be send to the Ethernet card.

i'am waiting for your response. thank you.
what I don't understand about this question is, once all the packets are sent to the Ethernet card, then what? isn't an Ethernet card meant to connect two machines via a network so you can send packets between them?

do you want those packets to stop at the ethernet card?

you do know that you can send those packets back to yourself (by using 127.0.0.1), right? if you don't want to send them out...

thank you for your time. i really need your help so please be patient with me.

i will explain to you what i want to develop:
i want to send packets from application layer via many UDP ports simultaneously, and in UDP layer the header will be added and all calculs done.after, packets passed to IP layer which add the ip header and do calculs (it is a single ip destination adress not mutlicast adress).then packets passed to Mac layer where is a scheduler (MUX) which regulate all Mac frames to one voice ready to be sent to physical layer with winpcap librairies. in the other hand there is a receiver (in my case i want to implement it in the same host with the transmitter) who will capture these frames from the physical layer with winpcap libraries and passes them to MAC layer where is a scheduler (DEMUX) then to ip layer to UDP layer to application layer.
so i think about threads to use one transmit thread who will sends frames to the physical layer and receiver thread who will receive frames from physical layer to application layer.
but sockets, i thought that are used only in udp layer to udp layer of the server.

Cordialement
Last edited on
have you tried this?

http://www.codeproject.com/KB/IP/UDPandWPCAP.aspx

initially, I wouldn't worry about threads too much - I would try to interface with winpcap first
pcap is just a listener. It listens to everything passing thru the network interface to which it is bound. You don't talk to pcap through your program, it just listens to what's passing thru the interface.

EDIT: I just read the link. Don't do that unless you have some specific reason. winpcap often can't keep up with a high speed interface running at high utilization. The result will be dropped packets.
Last edited on

looking nice.. just that I didn't understand the problem due to language constraints. I know english and c++ only.. :P
thank you so much kfmfe04, this code is a part af my program (with some changes,because i don't use gateway). my problem was to repeat this code many times with threads and in each sending i change some parameters. means i can accord to this part of code one thread and i send these packets,after i change parameters and i send second time packets (i don't know using the same thread or another thread). i don't know if you have an idea.

i don't want to bother you more. thank you for your help :)
Last edited on
hello kfmfe04,

have you,please, a link for a code of receiving packets from Ethernet card with winpcap in C++ or C language?

Thank you so much :)
Last edited on
no,i meant a code for receiving packets with winpcap and passing them from data link layer to application layer with all steps of checking headers and eliminating them.

in data link layer, MAC header will be checked and eliminatined and after that, packet passed to network layer where IP header will be checked and eliminated.after that, packet passed to transport layer where UDP header will be checked and eliminated. so now we have only payload that will be sent to application layer.

so the code that i need do the opposite of the sending code (that you post its link here in 9 may)

i hope you can help me :)


Topic archived. No new replies allowed.