- /* This first loop is basically unnecessary. No operating system has
- * buffers which cannot fit 14 bytes into them, so the write() will only be
- * called once. */
- while (sent_bytes < sizeof(i3_ipc_header_t)) {
- if ((n = write(sockfd, ((void*)&header) + sent_bytes, sizeof(i3_ipc_header_t) - sent_bytes)) == -1) {
- if (errno == EAGAIN)
- continue;
- return -1;
- }
-
- sent_bytes += n;
- }
-
- sent_bytes = 0;
-
- while (sent_bytes < message_size) {
- if ((n = write(sockfd, payload + sent_bytes, message_size - sent_bytes)) == -1) {
- if (errno == EAGAIN)
- continue;
- return -1;
- }
-
- sent_bytes += n;
- }