6.3. TCP/IP Concepts

As we have observed, communication involves a series of concepts that we will now discuss [Mal96, Com01]:

Example 6-4. Note

Name of the machine:

more /etc/hostname

Example 6-5. Note

Machine IP address:

more /etc/hosts

Example 6-6. Note

Pre-assigned ports in UNIX:

more /etc/services

This command shows the ports predefined with support to TCP or UDP communications.

Example 6-7. Note

Visualisation of the routing's configuration:

netstat -r

Example 6-8. Note

Domain and our DNS server is:

more /etc/default domain

more /etc/resolv.conf

Example 6-9. Note

arp tables:

arp to NameNode

The way for a programmer to use them is through an API (application programming interface) which implements this source-code interface. For TCP/IP, the most common API is the Berkeley Socket Library (Windows uses an equivalent library that is called Winsocks). This library makes it possible to create a communication end-point (socket), associate it to a remote node and port (bind) and offer the communication service (through connect, listen, accept, send, sendto, recv, recvfrom, for example). The library also provides a more general communication mode (AF INET family) and more optimised communications for cases in which the process are communicating within the same machine (AF UNIX family). In GNU/Linux, the socket library is part of the C standard library, Libc, (Libc6 in current versions), and it supports AF_INET, AF_UNIX, AF_IPX (for Novell protocols), AF_X25 (for the X.25 protocol), AF_ATMPVC-AF_ATMSVC (for the ATM protocol) and AF_AX25,F_NETROM, AF_ROSE (for amateur radio protocol).