fix ping loss, add ttl from ip header compile .h file to detect changes

This commit is contained in:
2025-05-22 15:30:34 +02:00
parent b96652f9a4
commit 94085f5bb2
6 changed files with 44 additions and 31 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
/* Updated: 2025/05/02 23:55:50 by tomoron ### ########.fr */
/* Updated: 2025/05/22 15:24:43 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -53,7 +53,7 @@ void ping_end_print(t_settings *set, char *host, t_stats *stats)
if(isnan(stddev) || isinf(stddev))
stddev = 0.0f;
printf("--- %s ping statistics ---\n", host);
percent = ((double)stats->sent / 100) * stats->received;
percent = ((double)(stats->sent - stats->received) / stats->sent) * 100.0;
printf("%lu packets transmitted, %lu packets received, %d%% packet loss\n", stats->sent, stats->received, percent);
printf("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n", stats->min, stats->avg, stats->max, stddev);
}