1NETREAD(3) Common Library Functions NETREAD(3)
2
3
4
6 netread - receive a message from a socket
7
9 #include "net.h"
10
11 int netread (int s, char *buf, int nbytes);
12
13 ssize_t netread_timeout (int s, void *buf, size_t nbytes, int timeout);
14
16 netread receives a message from a socket. It overcomes the message
17 fragmentation problem and always waits for all requested bytes to
18 arrive or a timeout/error occurs.
19
21 This routine returns the number of bytes if the operation was success‐
22 ful, 0 if the connection was closed by the remote end or -1 if the
23 operation failed. In the latter case, serrno is set appropriately.
24
26 EINTR The function was interrupted by a signal.
27
28 EBADF s is not a valid descriptor.
29
30 EAGAIN The socket is non-blocking and there is no message avail‐
31 able.
32
33 EFAULT buf is not a valid pointer.
34
35 EINVAL nbytes is negative or zero.
36
37 ENOTSOCK s is not a socket.
38
39 SECONNDROP Connection closed by remote end.
40
41 SETIMEDOUT Timed out.
42
44 recv(2), neterror(3)
45
47 LCG Grid Deployment Team
48
49
50
51LCG $Date: 2005/03/29 09:27:19 $ NETREAD(3)