Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(i = 1; i <= count; ++i){
- header.type = ICMP_ECHO;
- header.code = 0;
- header.checksum = 0;
- header.un.echo.sequence = htons(i);
- header.un.echo.id = htons(getpid() & 0xFFFF);
- header.checksum = in_cksum((unsigned short *)&header, 8, 0);
- send_icmp(sock, whereto, &header, &response);
- printf("%d bytes from : imp_sequence = %d, time = %f ms \n", (int) sizeof(response), ntohs(response.header.un.echo.sequence), response.timeElapsed * 1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement