lib/dgr.c
/** Serializes and sends DGR data out across a network. */
Serializes and sends DGR data out across a network.
Serializes and sends DGR data out across a network .
static void dgr_send(void)
{
#if !defined __MINGW32__ && !defined _WIN32
	if(dgr_disabled)
		return;
	int  bufSize = 0;
	char *buf = dgr_serialize(&bufSize);
	if(bufSize == 0 || dgr_list_size == 0)
		return;
	for(int i=0; i<dgr_addrinfo_len; i++)
	{
		int numbytes;
		if((numbytes = sendto(dgr_socket, buf, bufSize, 0,
		                      dgr_addrinfo[i]->ai_addr, dgr_addrinfo[i]->ai_addrlen)) == -1) {
			msg(MSG_FATAL, "DGR Master: sendto: %s", strerror(errno));
			exit(EXIT_FAILURE);
		}
		if(numbytes != bufSize) 
		{
			msg(MSG_FATAL, "DGR Master: Error sending all of the bytes in the message.");
			exit(EXIT_FAILURE);
		}
	}
	free(buf);
#endif 
}
static void dgr_send ( void ) { #if ! defined __MINGW32__ && ! defined _WIN32 if ( dgr_disabled ) return ; int bufSize = 0 ; char * buf = dgr_serialize ( & bufSize ) ; if ( bufSize == 0 || dgr_list_size == 0 ) return ; for ( int i = 0 ; i < dgr_addrinfo_len ; i ++ ) { int numbytes ; if ( ( numbytes = sendto ( dgr_socket , buf , bufSize , 0 , dgr_addrinfo [ i ] -> ai_addr , dgr_addrinfo [ i ] -> ai_addrlen ) ) == -1 ) { msg ( MSG_FATAL , " " , strerror ( errno ) ) ; exit ( EXIT_FAILURE ) ; } if ( numbytes != bufSize ) { msg ( MSG_FATAL , " " ) ; exit ( EXIT_FAILURE ) ; } } free ( buf ) ; #endif }
Serializes and sends DGR data out across a network.
Serializes and sends DGR data out across a network .
// no need to send an empty packet. /* If the message is too large to send, sendto() will not send the
	 * message, and will set errno to EMSGSIZE. The MTU may limit the
	 * amount of data that we can send. With an MTU of 1500, we can
	 * only expect to send 1472 bytes. Even with the small MTU, the
	 * system may still allow us to send larger UDP packets due to
	 * IPv4 fragmentation. */ // double check that everything got sent // __MINGW32__