exercises/ex04/trout/trout.c
void send_dgram (int ttl)
{
  int n;

  rec->seq = seq++;
  sock_set_port (sasend, salen, htons(dport+seq));

  Gettimeofday (sendtv, NULL);
  n = sendto(sendfd, sendbuf, datalen, 0, sasend, salen);

  if (n==-1 && errno == ECONNREFUSED) {
    Gettimeofday (sendtv, NULL);
    n = sendto(sendfd, sendbuf, datalen, 0, sasend, salen);
  }

  if (n != datalen) {
    err_sys("sendto error");
  }
}
/* the second effort send is a kludge to handle a funny
       thing, which is that the last host seems to refuse the
       second or third connection consistently, which might
       might mean that something breaks when we get the
       ICMP_DEST_UNREACH error.  The second attempt seems
       to succeed consistently. */
the second effort send is a kludge to handle a funny
thing, which is that the last host seems to refuse the
second or third connection consistently, which might
might mean that something breaks when we get the
ICMP_DEST_UNREACH error.  The second attempt seems
to succeed consistently.
the second effort send is a kludge to handle a funny thing which is that the last host seems to refuse the second or third connection consistently which might might mean that something breaks when we get the ICMP_DEST_UNREACH error . The second attempt seems to succeed consistently .
void send_dgram (int ttl)
{
  int n;
  rec->seq = seq++;
  sock_set_port (sasend, salen, htons(dport+seq));
  Gettimeofday (sendtv, NULL);
  n = sendto(sendfd, sendbuf, datalen, 0, sasend, salen);
  if (n==-1 && errno == ECONNREFUSED) {
    Gettimeofday (sendtv, NULL);
    n = sendto(sendfd, sendbuf, datalen, 0, sasend, salen);
  }
  if (n != datalen) {
    err_sys("sendto error");
  }
}
void send_dgram ( int ttl ) { int n ; rec -> seq = seq ++ ; sock_set_port ( sasend , salen , htons ( dport + seq ) ) ; Gettimeofday ( sendtv , NULL ) ; n = sendto ( sendfd , sendbuf , datalen , 0 , sasend , salen ) ; if ( n == -1 && errno == ECONNREFUSED ) { Gettimeofday ( sendtv , NULL ) ; n = sendto ( sendfd , sendbuf , datalen , 0 , sasend , salen ) ; } if ( n != datalen ) { err_sys ( " " ) ; } }
the second effort send is a kludge to handle a funny
thing, which is that the last host seems to refuse the
second or third connection consistently, which might
might mean that something breaks when we get the
ICMP_DEST_UNREACH error.
the second effort send is a kludge to handle a funny thing which is that the last host seems to refuse the second or third connection consistently which might might mean that something breaks when we get the ICMP_DEST_UNREACH error .