Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. for(i = 1; i <= count; ++i){
  2. header.type = ICMP_ECHO;
  3. header.code = 0;
  4. header.checksum = 0;
  5. header.un.echo.sequence = htons(i);
  6. header.un.echo.id = htons(getpid() & 0xFFFF);
  7. header.checksum = in_cksum((unsigned short *)&header, 8, 0);
  8. send_icmp(sock, whereto, &header, &response);
  9.  
  10. printf("%d bytes from : imp_sequence = %d, time = %f ms \n", (int) sizeof(response), ntohs(response.header.un.echo.sequence), response.timeElapsed * 1000);
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement