ssize_t sendmsg (
const struct msghdr *message,
[DIGITAL] The following definition of the sendmsg() function does not conform to current standards and is supported only for backward compatibility (see standards(5)):
int sendmsg (
struct msghdr *message,
Interfaces documented on this reference page conform to industry standards as follows:
The sendmsg function also supports POSIX.1g Draft 6.6.
Refer to the standards(5) reference page for more information about industry standards and associated tags.
Specifies the socket file descriptor. Points to a msghdr structure, containing pointers to both the destination address for the outgoing message and to buffers containing ancillary data. The format of the address is determined by the behavior requested for the socket.
The sendmsg() function sends messages through connected or unconnected sockets using the msghdr message structure. This minimizes the number of directly supplied parameters to the function call. The <sys/socket.h> file contains the msghdr structure and defines the structure members.
To broadcast on a socket, the application program must first issue a setsockopt() function using the SO_BROADCAST option to gain broadcast permissions.
[DIGITAL] When compiled in the X/Open UNIX environment, calls to the sendmsg() function are internally renamed by prepending _E to the function name. When you are debugging a module that includes the sendmsg() function and for which _XOPEN_SOURCE_EXTENDED has been defined, use _Esendmsg to refer to the sendmsg() call. See standards(5) for further information.
[DIGITAL] When compiled in the POSIX.1g socket environment, calls to the sendmsg() function are internally renamed by prepending _P to the function name. When you are debugging a module that includes the sendmsg() function and for which _POSIX_PII_SOCKET has been defined, use _Psendmsg to refer to the sendmsg() call. See standards(5) for further information.
Upon successful completion, the sendmsg() function returns the number of characters sent. Otherwise, a value of -1 is returned and errno is set to indicate the error.
If the sendmsg() function fails, errno may be set to one of the following values: Search permission is denied for a component of the path prefix; or write access to the named socket is denied. Addresses in the specified address family cannot be used with this socket. The socket parameter is not valid. A connection was forcibly closed by a peer. A signal interrupted sendmsg before any data was transmitted. The sum of the iov_len values overflows an ssize_t. An I/O error occurred while reading from or writing to the file system. Too many symbolic links were encountered in translating the pathname in the socket address. The message is too large to be sent all at once, as the socket requires. A component of the pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX characters. A component of the pathname does not name an existing file or the pathname is an empty string. A socket is connection-oriented but is not connected. A component of the path prefix of the pathname in address is not a directory. The socket parameter refers to a file, not a socket. The socket argument is associated with a socket that does not support one or more of the values set in flags. The socket is shut down for writing, or the socket is connection-oriented and the peer is closed or shut down for reading. In the latter case, and if the socket is of type SOCK_STREAM, the SIGPIPE signal is generated to the calling process. The socket is marked nonblocking, and no space is available for the sendmsg() function.
Functions: recv(2), recvfrom(2), recvmsg(2), send(2), sendto(2), shutdown(2), socket(2), select(2), getsockopt(2), setsockopt(2)
Standards: standards(5) delim off