Está en la página 1de 2

#include <sys/time.

h> // Libreria para el tiempo


.
.
.
.
.
int main (....)
{
struct timeval tiempo_i, tiempo_f; // Estructuras para calcular el tiempo
.
.
.
.
.
.
.
gettimeofday (&tiempo_i, 0); // Obtiene tiempo inicial

/* Aqui van la funcin para enviar o recibir tanto en TCP como UDP */

gettimeofday (&tiempo_f, 0); // Obtiene tiempo final

printf("Se demoro %ld microseg\n\n", tiempo_f.tv_usec - tiempo_i.tv_usec); // Imprime tiempo en recibir o enviar
.
.
.
.
.
.
}

También podría gustarte