26 #include <sys/types.h> 29 #include <arpa/inet.h> 31 #include <netinet/in.h> 36 int main(
int argc,
char **argv)
38 int sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
41 printf(
"Couldn't get a socket: %d [%s]\n", errno, strerror(errno));
49 FD_SET(sock, &readfd);
51 char *tmp = (
char *) malloc(2048);
54 select(sock + 1, &readfd, 0, 0, &t);
55 int n = read(sock, tmp, 2048);
57 printf(
"interface received %d bytes\n", n);