ipcsend(2)
NAME
ipcsend − send data on a NetIPC socket
SYNOPSIS
#include <sys/ns_ipc.h>
void ipcsend(
ns_int_t vcdesc,
const void *data,
ns_int_t dlen,
ns_int_t *flags,
short opt[],
ns_int_t *result);
DESCRIPTION
ipcsend() is used to send data on an established connection. The data can be sent as a single contiguous buffer or as a scattered data vector. If the data is vectored, Net IPC gathers all the referenced data before sending it.
For vectored writes an iovec structure contains the data vector. An iovec structure can be defined as:
struct iovec {
char *iov_base;
unsigned iov_len;
};
and the normal type for the data argument can be replaced by:
struct iovec *data;
Each iovec entry specifies the base address and length of an area in memory where data should be accessed. ipcsend() always fills-in one area completely before proceeding to the next area.
ipcsend() behaves differently, depending on whether the referenced socket is in synchronous or asynchronous mode. These differences are as follows:
Synchronous I/O.
Send requests issued against sockets in synchronous mode may block. ipcsend() blocks if it cannot immediately obtain the buffer space needed to accommodate the data. The call resumes after the required buffer space becomes available or after the socket timer expires. Timeouts are 60 seconds by default, and can be altered by calling ipccontrol().
Asynchronous I/O.
Send requests issued against sockets in asynchronous mode never block. If the buffer space required to accommodate the data is not immediately available, a NSR_WOULD_BLOCK error (code 56) is returned. After receiving this error, the process can try the call again later or determine when the socket is writeable by calling ipcselect().
PARAMETERS
vcdesc (input parameter) Socket descriptor. Refers to the virtual circuit (VC) socket endpoint of the connection through which the data will be sent. A VC socket descriptor is obtained by calling ipcconnect() or ipcrecvcn().
data (input parameter) A buffer to hold the data being sent, or a data vector that describes where the data to be sent is located.
dlen (input parameter) If data is a data buffer, dlen is the length in bytes of the data in the buffer. If data is a data vector, dlen is the length in bytes of the data vector.
flags (input parameter) See below.
opt (input parameter) An array of options and associated information. See below.
result (output parameter) The error code returned. Refer to ERRORS below for more information.
FLAGS PARAMETER
NSF_MORE_DATA (bit 26) (input parameter) When this bit is set, the underlying network protocol can temporarily delay sending data for efficiency reasons.
NSF_VECTORED (bit 31) (input parameter) When this bit is set, the data parameter refers to a data vector and not to a data buffer.
OPT PARAMETER
NSO_DATA_OFFSET (optioncode=8) (datalength=2) A two-byte integer that indicates a byte offset from the beginning of the data buffer where the data to be sent actually begins. Only valid if the data parameter is a data buffer.
RETURN VALUE
None. Errors are returned in the result parameter.
ERRORS
[NSR_BOUNDS_VIO] An address parameter is invalid.
[NSR_DESC] The vcdesc parameter is not a valid descriptor.
[NSR_DLEN] The value specified in the dlen parameter is invalid.
[NSR_DUP_OPTION] The opt array contains duplicate information.
[NSR_FLAGS] An illegal flag was specified.
[NSR_MSGSIZE] An illegal data length was specified. By default, data transfer is limited to a 100 byte maximum. You can alter this limit by calling ipccontrol() .
[NSR_NOT_CONNECTION] The vcdesc parameter is not a valid VC socket.
[NSR_OPT_OPTION] An option in the opt parameter in unknown or invalid.
[NSR_OPT_SYNTAX] A length or offset value in the opt parameter is invalid.
[NSR_SIGNAL_INDICATION] The call aborted due to a signal.
[NSR_SOCKET_TIMEOUT] The socket timer expired before the data could be transfered. By default, the socket timer is 60 seconds. This value can be altered by calling ipccontrol().
[NSR_TOO_MANY_VECTS] The maximum number of data vectors was exceeded. The limit is 16.
[NSR_VECT_COUNT] An incorrect data length was specified for vectored data.
[NSR_WOULD_BLOCK] The requested data cannot be sent at this time.
AUTHOR
ipcsend() was developed by HP.
SEE ALSO
ipcconnect(2), ipccontrol(2), ipccreate(2), ipcdest(2), ipcgetnodename(2), ipclookup(2), ipcname(2), ipcnamerase(2), ipcrecv(2), ipcrecvcn(2), ipcselect(2), ipcsetnodename(2), ipcshutdown(2), addopt(3N), initopt(3N), ipcerrmsg(3N), optoverhead(3N), readopt(3N).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992