Obtain and set time-out parameters (retransmission).
Control allocation of buffer space.
Determine if the socket allows transmission of broadcast messages.
Control processing of out-of-band data.
Obtaining and Setting
Host Names:
The internal name chosen to be the domain name of the
host, can be changed.
Gethostname(name, length)
Sethostname (name, length)
Obtaining and Setting
Internal Host Domain:
Similar to gethostname, these commands are used to set and get the internal domain.
Setdomainname (name, length)
Getdomainname (name, length)
Obtaining and Setting
The Time of Day:
Gettimeofday extracts the current time and date from
the system along with information about the local time zone.
Conversely, settimeofday allows the process to set these values accordingly.
Gettimeofday (tm, tmzone)
Settimeofday (tm, tmzone)
Tm - timeval structure.
Tmzone - timezone structure.
System Calls vs. Network Library Calls:
In addition to system calls, BSD UNIX operating systems use
a set of library routines which perform useful functions related to networking.
System vs. Library Calls:
System calls pass control to the computer’s operating system.
Library routines are similar to other procedures that a programmer binds into an executable program.
Accessing the Domain Naming System:
4.3 BSD UNIX provides several interface library
procedures to access TCP/IP's Domain Naming System.
The communication between clients and domain name servers
can include many options and parameters. To generalize,
they all use the resglobal data structure.
When using these procedures, a program must first call
res_init() to initialize the res global info.
Several of the procedures to access the DNS include:
res_mkquery - forms a DNS query and puts it in a memory buffer.
res_send - sends the query to the name server and obtains the response.
dn_expand - expands a compressed domain name into a full ASCII version.
dn_comp - compresses full domain names.
Obtaining Information about
Hosts:
When library procedures are used on a system that does not have access to the DNS, they use the following commands to obtain information about hosts.
Gethostbyname (namestr) - uses (/etc/hosts) file.
Gethostbyaddr (addr, len, type).
Obtaining Information about
Networks:
Two network library routines exist that allow a process
to access the network information database.
Getnetbyname (domain name)
Getnetbyaddr (netaddr, addrtype) - NetID
Obtaining Information about
Protocols:
Library routines to provide access to the database of
protocols available on a machine.