C Sockets Quick Reference

This section provides brief descriptions of the z/VM® C socket calls. For additional information about these socket functions, see the XL C/C++ for z/VM: Runtime Library Reference.

Table 1. C Sockets Quick Reference
Socket() Call Description
accept() Accepts a connection request from a foreign host.
bind() Assigns a local address to a socket.
close() Closes a socket.
connect() Requests a connection to a foreign host.
endhostent() Closes the HOSTS SITEINFO file.
endnetent() Closes the HOSTS ADDRINFO file.
endprotoent() Closes the ETC PROTO file.
endservent() Closes the ETC SERVICES file.
fcntl() Controls socket operating characteristics.
freeaddrinfo() Frees one or more addrinfo structures returned by getaddrinfo()
gai_strerror() Returns information on errors returned by getaddrinfo() and getnameinfo()
getaddrinfo() Resolves IP addresses (IPv4 or IPv6)
getclientid() Returns the identifier by which the calling application is known to the TCPIP virtual machine.
gethostbyaddr() Returns information about a host specified by an address.
gethostbyname() Returns information about a host specified by a name.
gethostent() Returns the next entry in the HOSTS SITEINFO file.
gethostid() Returns the unique identifier of the current host.
gethostname() Returns the standard name of the current host.
getnameinfo() Translates a socket address to a node name and service location
getnetbyaddr() Returns the network entry specified by address.
getnetbyname() Returns the network entry specified by name.
getnetent() Returns the next entry in the HOSTS ADDRINFO file.
getpeername() Returns the name of the peer connected to a socket.
getprotobyname() Returns a protocol entry specified by name.
getprotobynumber() Searches the ETC PROTO file for a specified protocol number.
getprotoent() Returns the next entry in the ETC PROTO file.
getservbyname() Returns a service entry specified by name.
getservbyport() Returns a service entry specified by port number.
getservent() Returns the next entry in the SERVICES file.
getsockname() Obtains the local socket name.
getsockopt() Gets options associated with sockets in the AF_IUCV, AF_INET, and AF_INET6 domains.
givesocket() Tells TCPIP to make the specified socket available to a takesocket() call issued by another application.
htonl() Translates host byte order to network byte order for a long integer.
htons() Translates host byte order to network byte order for a short integer.
if_freenameindex() Frees storage allocated by if_nameindex()
if_indextoname() Maps a network interface index to its corresponding name
if_nameindex() Returns all network interface names and indexes
if_nametoindex() Maps a network interface name to its corresponding index
inet_addr() Constructs an internet address from character strings set in standard dotted-decimal notation.
inet_lnaof() Returns the local network portion of an internet address.
inet_makeaddr() Constructs an internet address from a network number and a local address.
inet_netof() Returns the network portion of the internet address in network byte order.
inet_network() Constructs a network number from character strings set in standard dotted-decimal notation.
inet_ntoa() Returns a pointer to a string in dotted-decimal notation.
inet_ntop() Converts a binary IP address (IPv4 or IPv6) into string format
inet_pton() Converts an IP address (IPv4 or IPv6) in string format to binary format
ioctl() Performs special operations on a socket.
listen() Indicates that a stream socket is ready for a connection request from a foreign host.
maxdesc() Allows socket numbers to extend beyond default range of 0 - 49.
ntohl() Translates network byte order to host byte order for a long integer.
ntohs() Translates network byte order to host byte order for a short integer.
read() Reads a set number of bytes into a buffer.
readv() Obtains data from a socket and reads this data into specified buffers.
recv() Receives messages from a connected socket.
recvfrom() Receives messages from a datagram socket, regardless of its connection status.
recvmsg() Receives messages on a socket into an array of buffers.
select() Monitors activity on a set of sockets.
selectex() Monitors activity on a set of different sockets.
send() Transmits messages to a connected socket.
sendmsg() Sends messages on a socket from an array of buffers.
sendto() Transmits messages to a datagram socket, regardless of its connection status.
sethostent() Opens the HOSTS SITEINFO file at the beginning.
setnetent() Opens the HOSTS ADDRINFO file at the beginning.
setprotoent() Opens the ETC PROTO file at the beginning.
setservent() Opens the ETC SERVICES file at the beginning.
setsockopt() Sets options associated with a socket in the AF_IUCV, AF_INET, and AF_INET6 domains.
shutdown() Shuts down all or part of a full-duplex connection.
socket() Requests that a socket be created.
takesocket() Acquires a socket from another application.
write() Writes a set number of bytes from a buffer to a socket.
writev() Writes data in the buffers specified by an array of iovec structures.