Next:
3.1.7.6 Safe Raw Sockets
Up:
3.1.7 Safe Raw Sockets
Previous:
3.1.7.4 Safe Raw Sockets
3.1.7.5 Safe Raw Sockets - ICMP Sockets
To send and receive ICMP messages that are not associated with a specific TCP/UDP port number, the socket has to be bound to a specific ICMP identifier.
struct sockaddr_in sin;
sock = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
memset(& sin, 0, sizeof(sin));
sin.sin_port = htons(23456);
bind(sock, (struct sockaddr *)& sin, sizeof(sin);
Next:
3.1.7.6 Safe Raw Sockets
Up:
3.1.7 Safe Raw Sockets
Previous:
3.1.7.4 Safe Raw Sockets
Ian Wakeman 2005-04-22