Addressing AF_IUCV sockets in applications
![]()
To use AF_IUCV sockets in applications, you must code a special AF_IUCV sockaddr structure.
The primary difference between AF_IUCV sockets and TCP/IP sockets is how communication partners are identified (for example, how they are named). To use the AF_IUCV support in an application, code a sockaddr structure with AF_IUCV as the socket address family and with AF_IUCV address information.
struct sockaddr_iucv {
sa_family_t siucv_family; /* AF_IUCV */
unsigned short siucv_port; /* reserved */
unsigned int siucv_addr; /* reserved */
char siucv_nodeid[8]; /* reserved */
char siucv_userid[8]; /* guest user id */
char siucv_name[8]; /* application name */
};Where: - siucv_family
- is set to AF_IUCV (= 32).
- siucv_port, siucv_addr, and siucv_nodeid
- are reserved for future use. The
siucv_portandsiucv_addrfields must be zero. Thesiucv_nodeidfield must be set to exactly eight blanks. - siucv_userid
- specifies a HiperSockets device
or a z/VM guest virtual
machine. This specification implicitly sets the connection type for
the socket to a HiperSockets connection
or to a z/VM IUCV connection.
This field must be 8 characters long and, if necessary, padded at the end with blanks.
For HiperSockets connections, the
siucv_useridfield specifies the identifier that is set with thehsuidsysfs attribute of the HiperSockets device. Forbindthis is the identifier of a local device, and forconnectthis is the identifier of the HiperSockets device of the communication peer.For IUCV connections, the
siucv_useridfield specifies a z/VM user ID. Forbindthis is the identifier of the local z/VM guest virtual machine, and forconnectthis is the identifier of the z/VM guest virtual machine for the communication peer.Tip: Forbind, you can also specify 8 blanks. The AF_IUCV address family support then automatically substitutes the local z/VM user ID for you. - siucv_name
- is set to the application name by which the socket is known. Servers
advertise application names and clients use these application names
to connect to servers. This field must be 8 characters long and,
if necessary, padded with blanks at the end.
Similar to TCP or UDP ports, application names distinguish distinct applications on the same operating system instance. Do not call
bindfor names that begin withlnxhvc. These names are reserved for the z/VM IUCV HVC device driver.
For details, see the af_iucv man page.