X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FUDP_daytimed.c;h=6f40384940253e6d4a655ea650f588b2c74c8256;hp=4a7e03490b01ed76bfbc4229bed4b3eafab45d7d;hb=26f7a8bb19c6cb198c213757a97b6ac79e40db4b;hpb=6907e5e6ff5c69a34dc9d3664388cdb9f76ede82 diff --git a/sources/UDP_daytimed.c b/sources/UDP_daytimed.c index 4a7e034..6f40384 100644 --- a/sources/UDP_daytimed.c +++ b/sources/UDP_daytimed.c @@ -26,18 +26,18 @@ * * Usage: daytimed -h give all info * - * $Id: UDP_daytimed.c,v 1.1 2004/03/21 18:30:35 piccardi Exp $ - * ****************************************************************/ /* * Include needed headers */ -#include /* predefined types */ -#include /* include unix standard library */ -#include /* IP addresses conversion utiliites */ -#include /* socket library */ -#include /* include standard I/O library */ -#include +#include /* primitive system data types */ +#include /* unix standard library */ +#include /* IP addresses conversion utilities */ +#include /* socket constants, types and functions */ +#include /* standard I/O library */ +#include /* date and time constants, types and functions */ +#include /* C strings library */ +#include /* C standard library */ #define MAXLINE 80 /* Program begin */ @@ -101,7 +101,6 @@ int main(int argc, char *argv[]) } /* write daytime to client */ while (1) { - timeval = time(NULL); n = recvfrom(sock, buffer, MAXLINE, 0, (struct sockaddr *)&addr, &len); if (n < 0) { perror("recvfrom error"); @@ -112,6 +111,7 @@ int main(int argc, char *argv[]) printf("Request from host %s, port %d\n", buffer, ntohs(addr.sin_port)); } + timeval = time(NULL); snprintf(buffer, sizeof(buffer), "%.24s\r\n", ctime(&timeval)); n = sendto(sock, buffer, strlen(buffer), 0, (struct sockaddr *)&addr, sizeof(addr));