1t_rcv(3NSL) Networking Services Library Functions t_rcv(3NSL)
2
3
4
6 t_rcv - receive data or expedited data sent over a connection
7
9 #include <xti.h>
10
11 int t_rcv(int fd, void *buf, unsigned int nbytes, int *flags);
12
13
15 This function is part of the XTI interfaces which evolved from the TLI
16 interfaces. XTI represents the future evolution of these interfaces.
17 However, TLI interfaces are supported for compatibility. When using a
18 TLI function that has the same name as an XTI function, the tiuser.h
19 header file must be used. Refer to the TLI COMPATIBILITY section for
20 a description of differences between the two interfaces.
21
22
23 This function receives either normal or expedited data. The argument fd
24 identifies the local transport endpoint through which data will arrive,
25 buf points to a receive buffer where user data will be placed, and
26 nbytes specifies the size of the receive buffer. The argument flags may
27 be set on return from t_rcv() and specifies optional flags as described
28 below.
29
30
31 By default, t_rcv() operates in synchronous mode and will wait for data
32 to arrive if none is currently available. However, if O_NONBLOCK is set
33 by means of t_open(3NSL) or fcntl(2), t_rcv() will execute in asynchro‐
34 nous mode and will fail if no data is available. See TNODATA below.
35
36
37 On return from the call, if T_MORE is set in flags, this indicates
38 that there is more data, and the current transport service data unit
39 (TSDU) or expedited transport service data unit (ETSDU) must be
40 received in multiple t_rcv() calls. In the asynchronous mode, or under
41 unusual conditions (for example, the arrival of a signal or T_EXDATA
42 event), the T_MORE flag may be set on return from the t_rcv() call
43 even when the number of bytes received is less than the size of the
44 receive buffer specified. Each t_rcv() with the T_MORE flag set indi‐
45 cates that another t_rcv() must follow to get more data for the current
46 TSDU. The end of the TSDU is identified by the return of a t_rcv() call
47 with the T_MORE flag not set. If the transport provider does not sup‐
48 port the concept of a TSDU as indicated in the info argument on return
49 from t_open(3NSL) or t_getinfo(3NSL), the T_MORE flag is not meaning‐
50 ful and should be ignored. If nbytes is greater than zero on the call
51 to t_rcv(), t_rcv() will return 0 only if the end of a TSDU is being
52 returned to the user.
53
54
55 On return, the data is expedited if T_EXPEDITED is set in flags. If
56 T_MORE is also set, it indicates that the number of expedited bytes
57 exceeded nbytes, a signal has interrupted the call, or that an entire
58 ETSDU was not available (only for transport protocols that support
59 fragmentation of ETSDUs). The rest of the ETSDU will be returned by
60 subsequent calls to t_rcv() which will return with T_EXPEDITED set
61 in flags. The end of the ETSDU is identified by the return of a
62 t_rcv() call with T_EXPEDITED set and T_MORE cleared. If the entire
63 ETSDU is not available it is possible for normal data fragments to be
64 returned between the initial and final fragments of an ETSDU.
65
66
67 If a signal arrives, t_rcv() returns, giving the user any data cur‐
68 rently available. If no data is available, t_rcv() returns -1, sets
69 t_errno to TSYSERR and errno to EINTR. If some data is available,
70 t_rcv() returns the number of bytes received and T_MORE is set in
71 flags.
72
73
74 In synchronous mode, the only way for the user to be notified of the
75 arrival of normal or expedited data is to issue this function or check
76 for the T_DATA or T_EXDATA events using the t_look(3NSL) function.
77 Additionally, the process can arrange to be notified by means of the EM
78 interface.
79
81 On successful completion, t_rcv() returns the number of bytes received.
82 Otherwise, it returns −1 on failure and t_errno is set to indicate the
83 error.
84
86 T_DATAXFER, T_OUTREL.
87
89 On failure, t_errno is set to one of the following:
90
91 TBADF The specified file descriptor does not refer to a trans‐
92 port endpoint.
93
94
95 TLOOK An asynchronous event has occurred on this transport
96 endpoint and requires immediate attention.
97
98
99 TNODATA O_NONBLOCK was set, but no data is currently available
100 from the transport provider.
101
102
103 TNOTSUPPORT This function is not supported by the underlying trans‐
104 port provider.
105
106
107 TOUTSTATE The communications endpoint referenced by fd is not in
108 one of the states in which a call to this function is
109 valid.
110
111
112 TPROTO This error indicates that a communication problem has
113 been detected between XTI and the transport provider for
114 which there is no other suitable XTI error (t_errno).
115
116
117 TSYSERR A system error has occurred during execution of this
118 function.
119
120
122 The XTI and TLI interface definitions have common names but use differ‐
123 ent header files. This, and other semantic differences between the two
124 interfaces are described in the subsections below.
125
126 Interface Header
127 The XTI interfaces use the header file, xti.h. TLI interfaces should
128 not use this header. They should use the header:
129 #include <tiuser.h>
130
131 Error Description Values
132 The t_errno value that can be set by the XTI interface and cannot be
133 set by the TLI interface is:
134 TPROTO
135
137 See attributes(5) for descriptions of the following attributes:
138
139
140
141
142 ┌─────────────────────────────┬─────────────────────────────┐
143 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
144 ├─────────────────────────────┼─────────────────────────────┤
145 │Interface Stability │Committed │
146 ├─────────────────────────────┼─────────────────────────────┤
147 │MT-Level │Safe │
148 ├─────────────────────────────┼─────────────────────────────┤
149 │Standard │See standards(5). │
150 └─────────────────────────────┴─────────────────────────────┘
151
153 fcntl(2), t_getinfo(3NSL), t_look(3NSL), t_open(3NSL), t_snd(3NSL),
154 attributes(5), standards(5)
155
156
157
158SunOS 5.11 24 Aug 2007 t_rcv(3NSL)