3.2 Database Functions

The Windows Sockets specification defines the following "database" routines. As noted earlier, a Windows Sockets supplier may choose to implement these in a manner which does not depend on local database files. The pointer returned by certain database routines such as gethostbyname() points to a structure which is allocated by the Windows Sockets library. The data which is pointed to is volatile and is good only until the next Windows Sockets API call from that thread. Additionally, the application must never attempt to modify this structure or to free any of its components. Only one copy of this structure is allocated for a thread, and so the application should copy any information which it needs before issuing any other Windows Sockets API calls.

gethostbyaddr() *

Retrieve the name(s) and address corresponding to a network address.

gethostbyname() *

Retrieve the name(s) and address corresponding to a host name.

gethostname()

Retrieve the name of the local host.

getprotobyname() *

Retrieve the protocol name and number corresponding to a protocol name.

getprotobynumber() *

Retrieve the protocol name and number corresponding to a protocol number.

getservbyname() *

Retrieve the service name and port corresponding to a service name.

getservbyport() *

Retrieve the service name and port corresponding to a port.


* = The routine can block under some circumstances.