Sending A Packet Via The Raw Socket (Cont.)

Even more include files (for 'inet_aton'):
#include <netinet/in.h>
#include <arpa/inet.h>
And code:
struct sockaddr_in addr;

// prepare the address we're sending the packet to.
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
inet_aton("", &addr.sin_addr);

// finally, send the packet.
rc = sendto(s,
            &icpmhdr, sizeof(struct icmphdr),
            0 /* flags */,
            (struct sockaddr*)&addr, sizeof(addr));
if (rc == -1) {
Originally written by Valid HTML 4.01!guy keren