Next:
3.1.7.5 Safe Raw Sockets
Up:
3.1.7 Safe Raw Sockets
Previous:
3.1.7.3 Safe Raw Sockets
3.1.7.4 Safe Raw Sockets - ICMP Sockets
To receive ICMP error messages associated with a specific local TCP/UDP port, the ICMP socket needs to be bound to the port.
#include < planetlab.h >
struct sockaddr_in sin;
sock = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP_UDP);
memset(& sin, 0, sizeof(sin));
sin.sin_port = htons(9090);
bind(sock, (struct sockaddr *)& sin, sizeof(sin));
Next:
3.1.7.5 Safe Raw Sockets
Up:
3.1.7 Safe Raw Sockets
Previous:
3.1.7.3 Safe Raw Sockets
Ian Wakeman 2005-04-22