VMS Help
TCPIP Services, Programming Interfaces, Sockets API, sendmsg()
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Sends gathered bytes through a socket to any other socket.
Format
#include <types.h>
#include <socket.h>
int sendmsg ( int s, struct msghdr *msg, int flags ); (BSD
Version 4.4)
int sendmsg ( int s, struct omsghdr *msg, int flags ); (BSD
Version 4.3)
s
A socket descriptor created with the socket() function.
msg
A pointer to a msghdr structure containing the message to be
sent.
The msg_iov field of the msghdr structure is used as a series of
buffers from which data is read in order until msg_iovlen bytes
have been obtained.
flags
Can be either 0 or MSG_OOB. If it is equal to MSG_OOB, the data
is sent out of band. Data can be received before other pending
data on the receiving socket if the receiver specifies a flag of
MSG_OOB.
You can use this function on any socket to send data to any named
socket. The data in the msg_iov field of the msghdr structure
is sent to the socket whose address is specified in the msg_name
field of the structure. The receiving socket gets the data using
the read(), recv(), recvfrom(), or recvmsg() function. When the
iovec array specifies more than one buffer, the data is gathered
from all specified buffers before being sent.
If no space is available to buffer the data on the receiving end
of the connection, the sendmsg() function blocks until buffer
space becomes available. If the socket is defined as nonblocking,
the sendmsg() function fails with an errno indication of
EWOULDBLOCK. If the message is too large to be sent in one piece
and the socket type requires that messages be sent atomically
(SOCK_DGRAM), the sendmsg() fails with an errno indication of
EMSGSIZE.
If the address specified is an INADDR_BROADCAST address, the
SO_BROADCAST socket option must be set and the process must
have a system UIC, OPER, SYSPRV, or BYPASS privilege for the
I/O operation to succeed.
No indication of failure to deliver is implicit in the sendmsg()
function. All errors (except EWOULDBLOCK) are detected locally.
You can use the select() function to determine when it is
possible to send more data.
Related Functions
See also read(), recv(), recvfrom(), recvmsg(), socket(), and
getsockopt().
n The number of bytes sent.
-1 Error; errno is set to indicate the error.
ENOTSOCK The socket descriptor is invalid.
EFAULT An invalid user space address is specified for
a argument.
EMSGSIZE The socket requires that messages be sent
atomically, but the size of the message to be
sent makes this impossible.
EWOULDBLOCK Blocks if the system does not have enough
space for buffering the user data.
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.