1t_snd(3NSL) Networking Services Library Functions t_snd(3NSL)
2
3
4
6 t_snd - send data or expedited data over a connection
7
9 #include <xti.h>
10
11
12
13 int t_snd(int fd, void *buf, unsigned int nbytes, int flags);
14
15
17 This routine is part of the XTI interfaces which evolved from the TLI
18 interfaces. XTI represents the future evolution of these interfaces.
19 However, TLI interfaces are supported for compatibility. When using a
20 TLI routine that has the same name as an XTI routine, the tiuser.h
21 header file must be used. Refer to the TLI COMPATIBILITY section for
22 a description of differences between the two interfaces.
23
24
25 This function is used to send either normal or expedited data. The
26 argument fd identifies the local transport endpoint over which data
27 should be sent, buf points to the user data, nbytes specifies the num‐
28 ber of bytes of user data to be sent, and flags specifies any optional
29 flags described below:
30
31 T_EXPEDITED If set in flags, the data will be sent as expedited
32 data and will be subject to the interpretations of the
33 transport provider.
34
35
36 T_MORE If set in flags, this indicates to the transport
37 provider that the transport service data unit (TSDU)
38 (or expedited transport service data unit - ETSDU) is
39 being sent through multiple t_snd() calls. Each
40 t_snd() with the T_MORE flag set indicates that
41 another t_snd() will follow with more data for the cur‐
42 rent TSDU (or ETSDU).
43
44 The end of the TSDU (or ETSDU) is identified by a
45 t_snd() call with the T_MORE flag not set. Use of
46 T_MORE enables a user to break up large logical data
47 units without losing the boundaries of those units at
48 the other end of the connection. The flag implies noth‐
49 ing about how the data is packaged for transfer below
50 the transport interface. If the transport provider does
51 not support the concept of a TSDU as indicated in the
52 info argument on return from t_open(3NSL) or t_get‐
53 info(3NSL), the T_MORE flag is not meaningful and will
54 be ignored if set.
55
56 The sending of a zero-length fragment of a TSDU or
57 ETSDU is only permitted where this is used to indicate
58 the end of a TSDU or ETSDU; that is, when the T_MORE
59 flag is not set. Some transport providers also forbid
60 zero-length TSDUs and ETSDUs.
61
62
63 T_PUSH If set in flags, requests that the provider transmit
64 all data that it has accumulated but not sent. The
65 request is a local action on the provider and does not
66 affect any similarly named protocol flag (for example,
67 the TCP PUSH flag). This effect of setting this flag is
68 protocol‐dependent, and it may be ignored entirely by
69 transport providers which do not support the use of
70 this feature.
71
72
73
74 Note that the communications provider is free to collect data in a send
75 buffer until it accumulates a sufficient amount for transmission.
76
77
78 By default, t_snd() operates in synchronous mode and may wait if flow
79 control restrictions prevent the data from being accepted by the local
80 transport provider at the time the call is made. However, if O_NON‐
81 BLOCK is set by means of t_open(3NSL) or fcntl(2), t_snd() will exe‐
82 cute in asynchronous mode, and will fail immediately if there are flow
83 control restrictions. The process can arrange to be informed when the
84 flow control restrictions are cleared by means of either t_look(3NSL)
85 or the EM interface.
86
87
88 On successful completion, t_snd() returns the number of bytes (octets)
89 accepted by the communications provider. Normally this will equal the
90 number of octets specified in nbytes. However, if O_NONBLOCK is set or
91 the function is interrupted by a signal, it is possible that only part
92 of the data has actually been accepted by the communications provider.
93 In this case, t_snd() returns a value that is less than the value of
94 nbytes. If t_snd() is interrupted by a signal before it could transfer
95 data to the communications provider, it returns -1 with t_errno set
96 to TSYSERR and errno set to EINTR.
97
98
99 If nbytes is zero and sending of zero bytes is not supported by the
100 underlying communications service, t_snd() returns −1 with t_errno
101 set to TBADDATA.
102
103
104 The size of each TSDU or ETSDU must not exceed the limits of the trans‐
105 port provider as specified by the current values in the TSDU or ETSDU
106 fields in the info argument returned by t_getinfo(3NSL).
107
108
109 The error TLOOK is returned for asynchronous events. It is required
110 only for an incoming disconnect event but may be returned for other
111 events.
112
114 On successful completion, t_snd() returns the number of bytes accepted
115 by the transport provider. Otherwise, -1 is returned on failure and
116 t_errno is set to indicate the error.
117
118
119 Note that if the number of bytes accepted by the communications
120 provider is less than the number of bytes requested, this may either
121 indicate that O_NONBLOCK is set and the communications provider is
122 blocked due to flow control, or that O_NONBLOCK is clear and the func‐
123 tion was interrupted by a signal.
124
126 On failure, t_errno is set to one of the following:
127
128 TBADDATA Illegal amount of data:
129
130 o A single send was attempted specifying a TSDU
131 (ETSDU) or fragment TSDU (ETSDU) greater than
132 that specified by the current values of the
133 TSDU or ETSDU fields in the info argument.
134
135 o A send of a zero byte TSDU (ETSDU) or zero
136 byte fragment of a TSDU (ETSDU) is not sup‐
137 ported by the provider.
138
139 o Multiple sends were attempted resulting in a
140 TSDU (ETSDU) larger than that specified by
141 the current value of the TSDU or ETSDU fields
142 in the info argument - the ability of an XTI
143 implementation to detect such an error case
144 is implementation-dependent. See WARNINGS,
145 below.
146
147
148 TBADF The specified file descriptor does not refer to a trans‐
149 port endpoint.
150
151
152 TBADFLAG An invalid flag was specified.
153
154
155 TFLOW O_NONBLOCK was set, but the flow control mechanism pre‐
156 vented the transport provider from accepting any data at
157 this time.
158
159
160 TLOOK An asynchronous event has occurred on this transport
161 endpoint.
162
163
164 TNOTSUPPORT This function is not supported by the underlying trans‐
165 port provider.
166
167
168 TOUTSTATE The communications endpoint referenced by fd is not in
169 one of the states in which a call to this function is
170 valid.
171
172
173 TPROTO This error indicates that a communication problem has
174 been detected between XTI and the transport provider for
175 which there is no other suitable XTI error (t_errno).
176
177
178 TSYSERR A system error has occurred during execution of this
179 function.
180
181
183 The XTI and TLI interface definitions have common names but use differ‐
184 ent header files. This, and other semantic differences between the two
185 interfaces are described in the subsections below.
186
187 Interface Header
188 The XTI interfaces use the header file, xti.h. TLI interfaces should
189 not use this header. They should use the header:
190 #include <tiuser.h>
191
192 Error Description Values
193 The t_errno values that can be set by the XTI interface and cannot be
194 set by the TLI interface are:
195 TPROTO
196 TLOOK
197 TBADFLAG
198 TOUTSTATE
199
200
201 The t_errno values that this routine can return under different circum‐
202 stances than its XTI counterpart are:
203 TBADDATA
204
205
206 In the TBADDATA error cases described above, TBADDATA is returned, only
207 for illegal zero byte TSDU ( ETSDU) send attempts.
208
210 See attributes(5) for descriptions of the following attributes:
211
212
213
214
215 ┌─────────────────────────────┬─────────────────────────────┐
216 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
217 ├─────────────────────────────┼─────────────────────────────┤
218 │MT Level │Safe │
219 └─────────────────────────────┴─────────────────────────────┘
220
222 fcntl(2), t_getinfo(3NSL), t_look(3NSL), t_open(3NSL), t_rcv(3NSL),
223 attributes(5)
224
226 It is important to remember that the transport provider treats all
227 users of a transport endpoint as a single user. Therefore if several
228 processes issue concurrent t_snd() calls then the different data may be
229 intermixed.
230
231
232 Multiple sends which exceed the maximum TSDU or ETSDU size may not be
233 discovered by XTI. In this case an implementation-dependent error will
234 result, generated by the transport provider, perhaps on a subsequent
235 XTI call. This error may take the form of a connection abort, a TSY‐
236 SERR, a TBADDATA or a TPROTO error.
237
238
239 If multiple sends which exceed the maximum TSDU or ETSDU size are
240 detected by XTI, t_snd() fails with TBADDATA.
241
242
243
244SunOS 5.11 7 May 1998 t_snd(3NSL)