FreeBSD/contrib/ntp/ntpdate/ntpdate.c
/*
 * is_unreachable - check to see if we have a route to given destination
 *		    (non-blocking).
 */
check to see if we have a route to given destination
(non-blocking).
check to see if we have a route to given destination ( non - blocking ) .
static int
is_reachable (sockaddr_u *dst)
{
	SOCKET sockfd;
	sockfd = socket(AF(dst), SOCK_DGRAM, 0);
	if (sockfd == -1) {
		return 0;
	}
	if (connect(sockfd, &dst->sa, SOCKLEN(dst))) {
		closesocket(sockfd);
		return 0;
	}
	closesocket(sockfd);
	return 1;
}
static int is_reachable ( sockaddr_u * dst ) { SOCKET sockfd ; sockfd = socket ( AF ( dst ) , SOCK_DGRAM , 0 ) ; if ( sockfd == -1 ) { return 0 ; } if ( connect ( sockfd , & dst -> sa , SOCKLEN ( dst ) ) ) { closesocket ( sockfd ) ; return 0 ; } closesocket ( sockfd ) ; return 1 ; }
is_unreachable - check to see if we have a route to given destination
                  (non-blocking).
is_unreachable - check to see if we have a route to given destination ( non - blocking ) .