projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Nuovo capitolo sulla gestione avanzata dei processi, in cui si รจ
[gapil.git]
/
listati
/
ClientEcho_third.c
diff --git
a/listati/ClientEcho_third.c
b/listati/ClientEcho_third.c
index f1290ef091db9d02b0ba5c7a01b6e7266c483e47..401ac5df4580d9eaf132190682606ffa8bcf6d73 100644
(file)
--- a/
listati/ClientEcho_third.c
+++ b/
listati/ClientEcho_third.c
@@
-6,17
+6,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;
}