aboutsummaryrefslogtreecommitdiffstats
path: root/man2/select_tut.2
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2016-02-03 14:18:21 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2016-02-03 14:18:21 +0100
commitf145f667009b60e7da17d5b459533205202058dc (patch)
treec20a67ac3d51113e749ed5d36d323e729ebe3261 /man2/select_tut.2
parent887f19e8a10c44ad82ac30d2d7cbe4be6166a8a1 (diff)
downloadman-pages-f145f667009b60e7da17d5b459533205202058dc.tar.gz
select_tut.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man2/select_tut.2')
-rw-r--r--man2/select_tut.29
1 files changed, 6 insertions, 3 deletions
diff --git a/man2/select_tut.2 b/man2/select_tut.2
index ac9211a8ae..aaa0fad6c1 100644
--- a/man2/select_tut.2
+++ b/man2/select_tut.2
@@ -562,6 +562,7 @@ listen_socket(int listen_port)
perror("socket");
return \-1;
}
+
yes = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
&yes, sizeof(yes)) == \-1) {
@@ -569,6 +570,7 @@ listen_socket(int listen_port)
close(s);
return \-1;
}
+
memset(&addr, 0, sizeof(addr));
addr.sin_port = htons(listen_port);
addr.sin_family = AF_INET;
@@ -577,6 +579,7 @@ listen_socket(int listen_port)
close(s);
return \-1;
}
+
printf("accepting connections on port %d\\n", listen_port);
listen(s, 10);
return s;
@@ -723,7 +726,7 @@ main(int argc, char *argv[])
}
}
- /* NB: read oob data before normal reads */
+ /* NB: read OOB data before normal reads */
if (fd1 > 0)
if (FD_ISSET(fd1, &er)) {
@@ -782,14 +785,14 @@ main(int argc, char *argv[])
buf1_written += r;
}
- /* check if write data has caught read data */
+ /* Check if write data has caught read data */
if (buf1_written == buf1_avail)
buf1_written = buf1_avail = 0;
if (buf2_written == buf2_avail)
buf2_written = buf2_avail = 0;
- /* one side has closed the connection, keep
+ /* One side has closed the connection, keep
writing to the other side until empty */
if (fd1 < 0 && buf1_avail \- buf1_written == 0)