aboutsummaryrefslogtreecommitdiff
path: root/util.c
blob: 69271b5d105920ffe56c6a1878c7be0d325a8f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "util.h"
#include "debug.h"
#include "conf.h"

ssize_t sendall(int sockfd, char *buf, size_t len) {
	ssize_t total_sent = 0;
	ssize_t sent;
	do {
		if ((sent = send(sockfd, buf+total_sent, len-total_sent, 0)) == -1) {
			return -1;
		}
		total_sent += sent;
	} while (total_sent < len);
	DPn("SEND",buf,len);
	return 0;
}