06-02-2013, 11:22 AM
ADDRESS RESOLUTION PROTOCOL
AIM:
To get the MAC or Physical address of the system using Address Resolution Protocol.
ALGORITHM:
1. Include necessary header files.
2. Initialize the arpreq structure initially to zero.
3. Get the IPAddress of the system as command line argument.
4. Check whether the given IPAddress is valid.
5. Copy the IPAddress from sockaddr_in structure to arpreq structure using miscopy ()
system call.
6. Create a socket of type SOCK_DGRAM.
7. Calculate the MAC address for the given IPAddress using ioctl() system call.
8. Display the IPAddress and MAC address in the standard output.