dotpcap / packetnet

Official repository - High performance .Net assembly for dissecting and constructing network packets such as ethernet, ip, tcp, udp etc.
Mozilla Public License 2.0
474 stars 105 forks source link

EthernetPacket PhysicalAddress #90

Closed ghost closed 5 years ago

ghost commented 5 years ago

Love this project. Good job on it. I've got a question regarding physical address section of the ethernet packet. How can this be obtained without using SharpPcap? I saw an example of resolving it but it required this library to do it.

Another question is how can I transform my "ready" ethernetpacket into bytes that will be ready to be sent over a raw socket on windows using c#?

chmorgan commented 5 years ago

Hello!

Well you could look at the source code of the library or wikipedia to find out how to find those address portions of the ethernet packet. It's not too difficult or particularly easy either, that's why this library exists :-)

To convert your packet into a byte[] call the Bytes() function of the top level packet. Keep in mind that you'll have to send this packet via something like SharpPcap that can send it to raw to the adapter. Sending it to a tcp/udp socket won't work as the OS will be taking care of everything below the application layer.

chmorgan commented 5 years ago

Hi @gigajew. Closing this out. Please reopen if you have a specific question about packet net or usage.