projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Inserita una nota esplicativa sulla struttura dirent, su segnalazione di
[gapil.git]
/
sources
/
UDP_echo.c
diff --git
a/sources/UDP_echo.c
b/sources/UDP_echo.c
index b14e1f6cbb884fa711c07aae1ce019ebe770fe64..a3bbd9b8c4fac087caacace36f33ed3fcda45652 100644
(file)
--- a/
sources/UDP_echo.c
+++ b/
sources/UDP_echo.c
@@
-26,7
+26,7
@@
*
* Usage: echo -h give all info's
*
*
* Usage: echo -h give all info's
*
- * $Id: UDP_echo.c,v 1.
2 2004/05/02 13:10:32
piccardi Exp $
+ * $Id: UDP_echo.c,v 1.
3 2004/06/02 16:31:50
piccardi Exp $
*
****************************************************************/
/*
*
****************************************************************/
/*
@@
-98,8
+98,9
@@
int main(int argc, char *argv[])
perror("Address creation error");
return 1;
}
perror("Address creation error");
return 1;
}
+ connect(sock, &serv_add, sizeof(*serv_add));
/* do read/write operations */
/* do read/write operations */
- ClientEcho(stdin, sock
, &serv_add
);
+ ClientEcho(stdin, sock);
/* normal exit */
return 0;
}
/* normal exit */
return 0;
}
@@
-116,7
+117,7
@@
void usage(void) {
exit(1);
}
exit(1);
}
-void ClientEcho(FILE * filein, int socket
, struct sockaddr_in * serv_addr
)
+void ClientEcho(FILE * filein, int socket)
{
char sendbuff[MAXLINE+1], recvbuff[MAXLINE+1];
int nread, nwrite;
{
char sendbuff[MAXLINE+1], recvbuff[MAXLINE+1];
int nread, nwrite;
@@
-125,14
+126,13
@@
void ClientEcho(FILE * filein, int socket, struct sockaddr_in * serv_addr)
if (fgets(sendbuff, MAXLINE, filein) == NULL) {
return; /* if no input just return */
} else { /* else we have to write to socket */
if (fgets(sendbuff, MAXLINE, filein) == NULL) {
return; /* if no input just return */
} else { /* else we have to write to socket */
- nwrite = sendto(socket, sendbuff, strlen(sendbuff), 0,
- (struct sockaddr *) serv_addr, sizeof(*serv_addr));
+ nwrite = write(socket, sendbuff, strlen(sendbuff));
if (nwrite < 0) { /* on error stop */
printf("Errore in scrittura: %s", strerror(errno));
return;
}
}
if (nwrite < 0) { /* on error stop */
printf("Errore in scrittura: %s", strerror(errno));
return;
}
}
- nread = re
cvfrom(socket, recvbuff, strlen(sendbuff), 0, NULL, NULL
);
+ nread = re
ad(socket, recvbuff, strlen(sendbuff)
);
if (nread < 0) { /* error condition, stop client */
printf("Errore in lettura: %s\n", strerror(errno));
return;
if (nread < 0) { /* error condition, stop client */
printf("Errore in lettura: %s\n", strerror(errno));
return;