Commit 7fac60649dc8e565bcc2fb4c0ca5519f87a5ff52
1 parent
faa3a30b
Using send
Showing
1 changed file
with
2 additions
and
2 deletions
epoll4.c
... | ... | @@ -142,7 +142,7 @@ void server_run() { |
142 | 142 | printf("[+] data: %s\n", buf); |
143 | 143 | n = 0; |
144 | 144 | while (n != strlen(buf)) { |
145 | - int rv = write(events[i].data.fd, buf + n, strlen(buf) - n); | |
145 | + int rv = send(events[i].data.fd, buf + n, strlen(buf) - n, MSG_NOSIGNAL); | |
146 | 146 | if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) |
147 | 147 | continue; // FIXME: busy waiting - should wait using epoll |
148 | 148 | if (rv == -1) |
... | ... | @@ -192,7 +192,7 @@ void client_run() { |
192 | 192 | n = 0; |
193 | 193 | while (n != c) { |
194 | 194 | errno = 0; |
195 | - int rv = write(sockfd, buf + n, c - n); | |
195 | + int rv = send(sockfd, buf + n, c - n, MSG_NOSIGNAL); | |
196 | 196 | if (rv == -1 && (errno == EINTR)) |
197 | 197 | continue; |
198 | 198 | if (rv == -1) | ... | ... |