X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FUDP_echo.c;h=cc9e3ae786a378d0a1b2cbb2c57fb804c2f51b2b;hp=a3bbd9b8c4fac087caacace36f33ed3fcda45652;hb=b9b609733592f0013892cc95e223386282ae6d57;hpb=2a09a578f80e369673bd5ac24179c021e903358b diff --git a/sources/UDP_echo.c b/sources/UDP_echo.c index a3bbd9b..cc9e3ae 100644 --- a/sources/UDP_echo.c +++ b/sources/UDP_echo.c @@ -26,7 +26,7 @@ * * Usage: echo -h give all info's * - * $Id: UDP_echo.c,v 1.3 2004/06/02 16:31:50 piccardi Exp $ + * $Id: UDP_echo.c,v 1.4 2004/06/04 00:31:33 piccardi Exp $ * ****************************************************************/ /* @@ -44,7 +44,7 @@ #define MAXLINE 256 void usage(void); -void ClientEcho(FILE * filein, int socket, struct sockaddr_in *serv_add); +void ClientEcho(FILE * filein, int socket); void SigTERM_hand(int sig); /* Program begin */ @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) * Variables definition */ int sock, i; - struct sockaddr_in serv_add; + struct sockaddr_in dst_addr; /* * Input section: decode parameters passed in the calling * Use getopt function @@ -90,15 +90,15 @@ int main(int argc, char *argv[]) return 1; } /* initialize address */ - memset((void *) &serv_add, 0, sizeof(serv_add)); /* clear server address */ - serv_add.sin_family = AF_INET; /* address type is INET */ - serv_add.sin_port = htons(7); /* echo port is 7 */ + memset((void *) &dst_addr, 0, sizeof(dst_addr)); /* clear address */ + dst_addr.sin_family = AF_INET; /* address type is INET */ + dst_addr.sin_port = htons(7); /* echo port is 7 */ /* build address using inet_pton */ - if ( (inet_pton(AF_INET, argv[optind], &serv_add.sin_addr)) <= 0) { + if ( (inet_pton(AF_INET, argv[optind], &dst_addr.sin_addr)) <= 0) { perror("Address creation error"); return 1; } - connect(sock, &serv_add, sizeof(*serv_add)); + connect(sock, (struct sockaddr *) &dst_addr, sizeof(dst_addr)); /* do read/write operations */ ClientEcho(stdin, sock); /* normal exit */