exercises/ex04/trout/trout.c
int send_probes (int ttl)
{
  int i, probe, code, done;

  Setsockopt (sendfd, IPPROTO_IP, IP_TTL, &ttl, sizeof(int));
  bzero (salast, salen);

  printf ("%2d  ", ttl);
  fflush (stdout);

  done = 0; /* count the number of probes that generate an ICMP_DEST_UNREACH */

  for (probe = 0; probe < nprobes; probe++) {
    send_dgram (ttl);
    code = recv_dgram ();

    if (code == -3) {
      printf (" *");
    } else {
      print_report ();
    }

    if (code == -1) done++;
    fflush (stdout);
  }
  printf ("ms\n");
  return done;
}
/* send_probes: sends a set of probes with the given ttl and
   then waits for the replies.  The weird TOS options are there
   as a signal to the kernel to identify clink packets so it can
   fill in the timestamps.  I am assuming that they don't have
   any actual effect. */
sends a set of probes with the given ttl and
then waits for the replies.  The weird TOS options are there
as a signal to the kernel to identify clink packets so it can
fill in the timestamps.  I am assuming that they don't have
any actual effect.
sends a set of probes with the given ttl and then waits for the replies . The weird TOS options are there as a signal to the kernel to identify clink packets so it can fill in the timestamps . I am assuming that they don ' t have any actual effect .
int send_probes (int ttl)
{
  int i, probe, code, done;
  Setsockopt (sendfd, IPPROTO_IP, IP_TTL, &ttl, sizeof(int));
  bzero (salast, salen);
  printf ("%2d  ", ttl);
  fflush (stdout);
  done = 0; 
  for (probe = 0; probe < nprobes; probe++) {
    send_dgram (ttl);
    code = recv_dgram ();
    if (code == -3) {
      printf (" *");
    } else {
      print_report ();
    }
    if (code == -1) done++;
    fflush (stdout);
  }
  printf ("ms\n");
  return done;
}
int send_probes ( int ttl ) { int i , probe , code , done ; Setsockopt ( sendfd , IPPROTO_IP , IP_TTL , & ttl , sizeof ( int ) ) ; bzero ( salast , salen ) ; printf ( " " , ttl ) ; fflush ( stdout ) ; done = 0 ; for ( probe = 0 ; probe < nprobes ; probe ++ ) { send_dgram ( ttl ) ; code = recv_dgram ( ) ; if ( code == -3 ) { printf ( " " ) ; } else { print_report ( ) ; } if ( code == -1 ) done ++ ; fflush ( stdout ) ; } printf ( " \n " ) ; return done ; }
send_probes: sends a set of probes with the given ttl and
then waits for the replies.
send_probes : sends a set of probes with the given ttl and then waits for the replies .
/* count the number of probes that generate an ICMP_DEST_UNREACH */