FreeBSD/libexec/tftpd/tftp-io.c
/*
 * Send an ACK packet (acknowledgement).
 */
Send an ACK packet (acknowledgement).
Send an ACK packet ( acknowledgement ) .
int
send_ack(int fp, uint16_t block)
{
	struct tftphdr *tp;
	int size;
	char buf[MAXPKTSIZE];
	if (debug&DEBUG_PACKETS)
		tftp_log(LOG_DEBUG, "Sending ACK for block %d", block);
	DROPPACKETn("send_ack", 0);
	tp = (struct tftphdr *)buf;
	size = sizeof(buf) - 2;
	tp->th_opcode = htons((u_short)ACK);
	tp->th_block = htons((u_short)block);
	size = 4;
	if (sendto(fp, buf, size, 0,
	    (struct sockaddr *)&peer_sock, peer_sock.ss_len) != size) {
		tftp_log(LOG_INFO, "send_ack: %s", strerror(errno));
		return (1);
	}
	return (0);
}
int send_ack ( int fp , uint16_t block ) { struct tftphdr * tp ; int size ; char buf [ MAXPKTSIZE ] ; if ( debug & DEBUG_PACKETS ) tftp_log ( LOG_DEBUG , " " , block ) ; DROPPACKETn ( " " , 0 ) ; tp = ( struct tftphdr * ) buf ; size = sizeof ( buf ) - 2 ; tp -> th_opcode = htons ( ( u_short ) ACK ) ; tp -> th_block = htons ( ( u_short ) block ) ; size = 4 ; if ( sendto ( fp , buf , size , 0 , ( struct sockaddr * ) & peer_sock , peer_sock . ss_len ) != size ) { tftp_log ( LOG_INFO , " " , strerror ( errno ) ) ; return ( 1 ) ; } return ( 0 ) ; }
Send an ACK packet (acknowledgement).
Send an ACK packet ( acknowledgement ) .