This explains Designing  a client-server program in which server provides the MAC address of the IP (within the same network) provided by the client.