2.6. Domain name and service resolution functions

Though the main purpose of the library is working with data oriented TCP/IP connections, domain name resolution is another vital part because it is seldom the case when the numeric address of the destination connection endpoint is known to the user. The library provides a limited set of functions sufficient to resolve hostnames and locate services using DNS.

The preferred way to establish a connection is to use service discovery, a technology that provides failure safety, load balancing and other ways to improve the user experience (see RFC2782 for details). The library provides a function for locating a service and connecting to it, rascal_connect_service, and a function to install a local service handler, rascal_accept_service.

For traditional DNS lookup there are functions rascal_gethost and rascal_getaddr. The library relies on a recursive name server (the vast majority of end-user name servers, such as ones operated by ISPs, are recursive).

The library supports multiple name servers for the purpose of failure safety. The list of available servers is read from system settings when the library is initialized. If an application needs to use a different set of name servers, it can be done using the rascal_set_nameserver function.