[Index of Books][Next Chapter]

TCP/IP for DOS Socket Library Reference

Chapter 4. Functions by Category

This chapter lists the functions in the DOS Socket Library and the Windows Socket Library by category, with a brief description of each function.

NOTE: All functions are common to both the DOS and Windows libraries except for the Windows library-specific functions listed in Table 4-IO and the DOS library-specific functions listed in Table 4-11.

See Appendix A, "Socket Library Functions," for an alphabetical listing of all the functions in these tables.

Table 4-1. Socket Management Functions
Function Description
accept() Accepts a connection from a remote host.
bind() Associates local address information with a socket.
connect() Initiates a connection request to a remote host.
getpeername() Gets the name of a connected peer.
getsockname() Gets the socket name.
getsockopt() Accesses current parameters for socket operation.
ioctl() Performs special operations on a socket.
listen() Prepares a socket to accept a connection.
select() Performs multiplexed socket status queries.
setsockopt() Establishes optional parameters for socket operation.
shutdown() Terminates one side of a full-duplex connection.
socket() Creates a socket for communication.
soclose() Terminates a socket endpoint.

Table 4-2. Synchronous Socket Input/Output Functions
Function Description
readv() Inputs network data from a connected stream or unconnected datagram socket. Stores the data in multiple application buffers.
recv() Inputs network data from a connected stream or datagram socket. Stores the data in a single application buffer.
recvfrom() Inputs network data from any stream or datagram socket. Stores the data in a single application buffer.
recvmsg() Inputs network data from any stream or datagram socket. Stores the data in multiple application buffers.
send() Outputs to a connected stream or datagram socket. Uses the data from a single application buffer.
sendmsg() Outputs to any stream or datagram socket. Uses the data from multiple application buffers.
sendto() Outputs to any stream or datagram socket. Uses the data from a single application buffer.
soread() Inputs network data from a connected stream or datagram socket. Stores the data in a single application buffer.
sowrite() Outputs to a connected stream or datagram socket. Uses the data from a single application buffer.
writev() Outputs to a connected stream or datagram socket. Uses the data from multiple application buffers.

Table 4-3. Byte Order Conversion Functions
Function Input Value Description
htons() 16-bit value Converts from host data order to network data order.
htonl() 32-bit value Converts from host data order to network data order.
ntohs() 16-bit value Converts from network data order to host data order.
ntohl() 32-bit value Converts from network data order to host data order.

Table 4-4. Internet Address Conversion Functions
Function Description
inet_addr() Converts an address in dotted notation to a numeric Internet address.
inet_network() Converts an address in dotted notation to a network number.
inet_ntoa() Extracts a network number from an Internet address.
inet_netof() Extracts the network number from an Internet address.
inet_lnaof() Extracts the local host address from an Internet address.
inet_makeaddr() Combines an Internet network number and a numeric host address to form a numeric Internet address.

Table 4-5. Transport Database Access Functions.
Function Description
gethostbyname() Accesses a HOSTS file entry by hostname.
gethostbyaddr() Accesses a HOSTS file entry by Internet address.
getnetbyname() Accesses a NETWORKS file entry by hostname.
getnetbyaddr() Accesses a NETWORKS file entry by Internet address.
getprotobyname() Accesses a PROTOCOL file entry by protocol name.
getprotobynumber() Accesses a PROTOCOL file entry by protocol number.
getservbyname() Accesses a SERVICES file entry by hostname.
getservbyport() Accesses a SERVICES file entry by port number.

Table 4-6. Asynchronous Socket Management Functions
Function Description
accept_anr() Accepts a connection from a remote host.
connect_anr() Initiates a connection request to a remote host.
select_anr() Performs multiplexed socket status queries.
soclose_anr() Terminates a socket endpoint.

Table 4-7. Asynchronous Socket Input/Output Functions
Function Description
readv_anr() Inputs network data from a connected stream or unconnected datagram socket. Stores the data in multiple application buffers.
recv_anr() Inputs network data from a connected stream or datagram socket. Stores the data in a single application buffer.
recvfrom_anr() Inputs network data from any stream or datagram socket. Stores the data in a single application buffer.
recvmsg_anr() Inputs network data from any stream or datagram socket. Stores the data in multiple application buffers.
send_anr() Outputs to a connected stream or datagram socket. Uses the data stored in a single application buffer.
sendmsg_anr() Outputs to any stream or datagram socket. Uses the data stored in multiple application buffers.
sendto_anr() Outputs to any stream or datagram socket. Uses the data stored in a single application buffer.
soread_anr() Inputs network data from a connected stream or datagram socket. Stores the data in a single application buffer.
sowrite_anr() Outputs to a connected stream or datagram socket. Uses the data from a single application buffer.
writev_anr() Outputs to a connected stream or datagram socket. Uses the data stored in multiple application buffers.

Table 4-8. Name Resolution Functions
Function Description
dn_comp() Compresses and stores a domain name.
dn_expand() Expands a compressed domain name.
raddr() Takes a 32-bit Internet address and returns a hostname.
rhost() Takes an Internet hostname and returns a 32-bit Internet address.
res_init() Initializes the name resolver.
res_mkquery() Creates a standard domain name query message.
res_send() Sends a standard domain name query message to name servers.

Table 4-9. Miscellaneous Functions
Function Description
bcopy() Copies bytes between strings.
bcmp() Compares byte strings.
bzero() Fills a string with null bytes.
getmyipaddr() Gets the Internet address of the local host.
getmymacaddr() Gets the MAC address of the local host.
loaded() Verifies the presence of TCP/IP transport drivers.

Table 4-10. Windows-Specific Functions
Function Description
GetErrno() Returns the C runtime errno variable
GetDNSErrno() Returns the C runtime dns_errno variable.
GetHErrno() Returns the C runtime h_errno variable.

Table 4-11. DOS-Specific Functions
Function Description
_abort_oper() Terminates a socket library function on break interrupt.
soperror() Prints networking or C runtime error.