'\"macro stdmacro
.if n .pH g3n.t_sndudata @(#)t_sndudata	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} t_sndudata 3N "Networking Support Utilities" "\&"
.if \nX=1 .ds x} t_sndudata 3N "Networking Support Utilities"
.if \nX=2 .ds x} t_sndudata 3N "" "\&"
.if \nX=3 .ds x} t_sndudata "" "" "\&"
.if \nX=4 .ds x} t_sndudata "NS_LIB" "EXTENSION" " "
.TH \*(x}
.SH NAME
\f4t_sndudata\f1 \- send a data unit
.SH SYNOPSIS
\f4#include <tiuser.h>\f1
.PP
\f4int t_sndudata (int fd, struct t_unitdata \(**unitdata);\f1
.SH DESCRIPTION
This function is used
in connectionless mode
to send a data unit to another transport
user.
\f4fd\fP
identifies the local transport endpoint through which data will be
sent, and
\f4unitdata\fP
points to a \f4t_unitdata\f1 structure containing the following members:
.PP
.RS
\f4struct netbuf addr;\fP
.br
\f4struct netbuf opt;\fP
.br
\f4struct netbuf udata;\fP
.RE
.PP
\f4netbuf\f1 is described in \f4intro\fP(3).
In \f4unitdata\fP, \f4addr\fP specifies the protocol address of the
destination user, \f4opt\fP identifies protocol-specific options that
the user wants associated with this request, and \f4udata\fP
specifies the user data to be sent.
The user may choose not to specify what protocol
options are associated with the transfer by setting the
\f4len\fP field of \f4opt\fP to zero.
In this case, the provider may use default options.
.PP
If the \f4len\fP field of \f4udata\fP is zero, and the sending of zero
bytes is not supported by the underlying transport provider,
\f4t_sndudata\fP will return \-1 with \f4t_errno\fP set to
\f4TBADDATA\fP.
.PP
By default,
\f4t_sndudata\fP
operates in synchronous mode and
may wait if flow control restrictions prevent the data from
being accepted by the local transport provider at the time
the call is made.
However, if \f4O_NDELAY\fP or \f4O_NONBLOCK\fP is set (via \f4t_open\fP
or \f4fcntl\fP), \f4t_sndudata\fP will execute in asynchronous mode
and will fail under such conditions.
.PP
If \f4t_sndudata\fP is issued from an invalid state,
or if the amount of data specified in \f4udata\fP exceeds the \f4TSDU\fP
size as returned in the \f4tsdu\fP field of the \f4info\fP argument of
\f4t_open\fP or \f4t_getinfo\fP, the provider will generate an \f4EPROTO\fP
protocol error.
(See \f4TSYSERR\fP below.)
If the state is invalid, this error may not occur until a subsequent
reference is made to the transport endpoint.
.P
On failure, \f4t_errno\f1 may be set to one of the following:
.TP 18
\f4[TBADF]\fP
The specified file descriptor does not refer to a transport endpoint.
.TP
\f4[TFLOW]\fP
\f4O_NDELAY\fP or \f4O_NONBLOCK\fP was set, but the flow control mechanism
prevented the transport provider from accepting data at this time.
.TP
\f4[TNOTSUPPORT]\fP
This function is not supported by the underlying transport
provider.
.TP
\f4[TSYSERR]\fP
A system error has occurred during execution of this function.
.TP
\f4[TBADDATA]\fP
\f4nbytes\fP is zero and sending zero bytes is not supported by the
transport provider.
.SH SEE ALSO
\f4intro\fP(3), \f4t_rcvudata\fP(3N), \f4t_rcvuderr\fP(3N).
.sp .2
\f2UNIX System V Network Programmer's Guide\f1.
.SH DIAGNOSTICS
\f4t_sndudata\fP
returns 0 on successful completion and \-1 on failure
\f4t_errno\f1 is set to indicate the error.
.Ee
