amany said:
Hello everyone
am trying to analyze the packet i got through a simple peer to peer
masseges and i wont to view the informations of the layer 3 and layer 2
frame like (IP address and MAC address)if anyone can help ASAP cindly
Thx
Hi amany,
The MAC address appears in the Ethernet header, and you cannot easily read
that. However, if you have an instance of a Socket object, and are
receiving the packet through the Socket, then you can adjust the parameters
of the Socket's IP layer to include the IP header.
You need to take a look at the SetSocketOption method of the Socket class,
and you need to set the option HeaderIncluded on the IP layer. MSDN has an
example about using SetSocketOption, on their website. Here is the URL:
http://msdn2.microsoft.com/en-us/library/1011kecd.aspx#
A quick Google, with the right keywords, turns up some relevant examples.
Remember: If you turn on HeaderIncluded, you also have to format your own
IP header.