projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Corretto uso del file nel programma, inserite spiegazioni
[gapil.git]
/
sources
/
TCP_echo.c
diff --git
a/sources/TCP_echo.c
b/sources/TCP_echo.c
index c8c5c1ac97910381607852c971c5ce1c3203d11c..57d61840120e90adc83a046a274b62e4a3f1a9a4 100644
(file)
--- a/
sources/TCP_echo.c
+++ b/
sources/TCP_echo.c
@@
-26,7
+26,7
@@
*
* Usage: echo -h give all info's
*
*
* Usage: echo -h give all info's
*
- * $Id: TCP_echo.c,v 1.
9 2003/10/18 16:30:23
piccardi Exp $
+ * $Id: TCP_echo.c,v 1.
10 2003/10/19 10:38:27
piccardi Exp $
*
****************************************************************/
/*
*
****************************************************************/
/*
@@
-144,17
+144,17
@@
void ClientEcho(FILE * filein, int socket)
fd_set fset;
/* initialize file descriptor set */
FD_ZERO(&fset);
fd_set fset;
/* initialize file descriptor set */
FD_ZERO(&fset);
- maxfd = max(fileno(
std
in), socket) + 1;
+ maxfd = max(fileno(
file
in), socket) + 1;
while (1) {
while (1) {
- FD_SET(socket, &fset); /* set for the socket */
- FD_SET(fileno(
std
in), &fset); /* set for the standard input */
+ FD_SET(socket, &fset);
/* set for the socket */
+ FD_SET(fileno(
file
in), &fset); /* set for the standard input */
select(maxfd, &fset, NULL, NULL, NULL); /* wait for read ready */
select(maxfd, &fset, NULL, NULL, NULL); /* wait for read ready */
- if (FD_ISSET(fileno(
stdin), &fset)) {
/* if ready on stdin */
+ if (FD_ISSET(fileno(
filein), &fset)) {
/* if ready on stdin */
if (fgets(sendbuff, MAXLINE, filein) == NULL) { /* if no input */
if (fgets(sendbuff, MAXLINE, filein) == NULL) { /* if no input */
- return; /* we stopped client */
- } else { /* else we have to write to socket */
+ return;
/* we stopped client */
+ } else {
/* else we have to write to socket */
nwrite = FullWrite(socket, sendbuff, strlen(sendbuff));
nwrite = FullWrite(socket, sendbuff, strlen(sendbuff));
- if (nwrite < 0) { /* on error stop */
+ if (nwrite < 0) {
/* on error stop */
printf("Errore in scrittura: %s", strerror(errno));
return;
}
printf("Errore in scrittura: %s", strerror(errno));
return;
}