version 1.14, 2001/03/16 08:16:17 |
version 1.15, 2001/03/19 10:52:51 |
|
|
unsigned char buf[4096]; |
unsigned char buf[4096]; |
|
|
len = atomicio(read, fd, buf, 4); |
len = atomicio(read, fd, buf, 4); |
if (len != 4) |
if (len == 0) |
|
fatal("Connection closed"); |
|
else if (len == -1) |
fatal("Couldn't read packet: %s", strerror(errno)); |
fatal("Couldn't read packet: %s", strerror(errno)); |
|
|
msg_len = GET_32BIT(buf); |
msg_len = GET_32BIT(buf); |
|
|
|
|
while (msg_len) { |
while (msg_len) { |
len = atomicio(read, fd, buf, MIN(msg_len, sizeof(buf))); |
len = atomicio(read, fd, buf, MIN(msg_len, sizeof(buf))); |
if (len <= 0) |
if (len == 0) |
|
fatal("Connection closed"); |
|
else if (len == -1) |
fatal("Couldn't read packet: %s", strerror(errno)); |
fatal("Couldn't read packet: %s", strerror(errno)); |
|
|
msg_len -= len; |
msg_len -= len; |