setibmsockopt() — Set IBM specific options associated with a socket

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both  

Format

#define _OPEN_SYS_SOCK_EXT
#include <sys/socket.h>

int setibmsockopt(int s, int level, int optname, char *optval, size_t optlen);

General description

These options are only valid on IBM® systems and can be specified to allow improved processing of requests on sockets.
Parameter
Description
s
The socket descriptor.
level
The level for which the option is set.
optname
The name of a specified socket option. The socket option currently available is:
  • SO_EioIfNewTP
optval
The pointer to option data.
optlen
The length of the option data.

Usage notes

The SO_EioIfNewTP option allows a socket application that has bound INADDRANY to be notified if a new common inet transport provider was activated after the socket was created. In order to activate this option, the option data should have a value of 1. To deactivate this option, supply a value of 0 for the option data. This option can be useful to a server that is listening - waiting for requests to come in from a number of sources. When a new transport provider is activated while this option is in effect, the application program will receive an EIO on the next accept, select or read request. Once this happens, the application should close the current socket and create a new one - thus enabling the socket to communicate with the new transport provider.

Returned value

If successful, setibmsockopt() returns 0.

If unsuccessful, setibmsockopt() returns -1 and sets errno to one of the following values:
Error Code
Description
EBADF
The s parameter is not a valid socket descriptor.
EFAULT
Using optval and optlen parameters would result in an attempt to access storage outside the caller's address space.
ENOPROTOOPT
The optname parameter is unrecognized. The level parameter is not SOL_SOCKET. The domain of the socket descriptor is not AF_INET. The socket descriptor is not a datagram type socket.

Related information