1NETREAD(3) Common Library Functions
2NETREAD(3)
3
4
5
6[1mNAME[0m
7 netread ‐ receive a message from a socket
8
9[1mSYNOPSIS[0m
10 [1m#include "net.h"[0m
11
12 [1mint netread (int [4m[22ms[24m[1m, char
13*[4m[22mbuf[24m[1m, int [4m[22mnbytes[24m[1m);[0m
14
15 [1mssize_t netread_timeout (int [4m[22ms[24m[1m, void
16*[4m[22mbuf[24m[1m, size_t [4m[22mnbytes[24m[1m, int [4m[22mtime‐
17out[24m[1m);[0m
18
19[1mDESCRIPTION[0m
20 [1mnetread [22mreceives a message from a socket. It
21overcomes the message
22 fragmentation problem and always waits for all re‐
23quested bytes to
24 arrive or a timeout/error occurs.
25
26[1mRETURN VALUE[0m
27 This routine returns the number of bytes if the operation
28was success‐
29 ful, 0 if the connection was closed by the remote end or
30‐1 if the
31 operation failed. In the latter case, [1mserrno [22mis set
32appropriately.
33
34[1mERRORS[0m
35 [1mEINTR [22mThe function was interrupted by a sig‐
36nal.
37
38 [1mEBADF [4m[22ms[24m is not a valid descriptor.
39
40 [1mEAGAIN [22mThe socket is non‐blocking and there
41is no message avail‐
42 able.
43
44 [1mEFAULT [4m[22mbuf[24m is not a valid pointer.
45
46 [1mEINVAL [4m[22mnbytes[24m is negative or zero.
47
48 [1mENOTSOCK [4m[22ms[24m is not a socket.
49
50 [1mSECONNDROP [22mConnection closed by remote end.
51
52 [1mSETIMEDOUT [22mTimed out.
53
54[1mSEE ALSO[0m
55 [1mrecv(2)[22m, [1mneterror(3)[0m
56
57[1mAUTHOR[0m
58 [1mLCG Grid Deployment [22mTeam
59
60
61
62LCG $Date: 2005/03/29 09:27:19 $
63NETREAD(3)
64
65
66