Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

intro(3n)

NAME

intro − introduction to network library functions

DESCRIPTION

This section describes functions that are available for interprocess communication (IPC).  IPC takes place using sockets.  The socket() system call creates a communications channel based on domain, type, and protocol.

Sockets are created without names.  The bind() system call is used to connect a name to a socket.

A connection with another process must be made before data can be transferred on a bound socket.  The connect() system call is used to rendezvous with another process.  This process must be listening on a bound socket using the listen() system call.  This listening process can accept a connection request using the accept() system call.

Once two processes have connected and accepted an IPC, data can be transferred with the following system calls: read(;); write(;); send(,), and recv(.).

Connectionless sockets are also possible (a socket is bound and data can be transferred).  They use the following system calls to transfer data: sendto and recvfrom.

IPC operates in three domains:

UNIX local node

INTERNET local area network (LAN)

DECNET DECnet network

These types of sockets are available for IPC:

stream Sequenced, reliable, unduplicated data
CONNECTED socket
record boundaries not preserved
all domains

datagram Not guaranteed to be sequenced, reliable, or unduplicated
user protocol needed to give guarantees
UNCONNECTED socket
record boundaries preserved
UNIX and INTERNET domains

sequenced packet Like stream socket, except record boundaries preserved
DECNET domain only

raw Access to communications protocols

ROUTINES TO MANIPULATE INTERNET ADDRESSES

The inet routines manipulate Internet addresses. 

ROUTINES TO MANIPULATE NETWORK DATA BASE FILES

Standard mapping routines are used to retrieve entries in network data base files.  Several routines operating on each data base file are identified by a group name:

gethostent retrieves entries from /etc/hosts

getnetent retrieves entries from /etc/networks

getprotoent retrieves entries from /etc/protocols

getservent retrieves entries from /etc/services

Specific routines perform particular operations on each data base file:

get...ent reads the next line of the file; opens the file, if necessary. 

set...ent opens and rewinds the file. 

end...ent closes the file

get...byname searches the file sequentially from the beginning until a matching name is found, or EOF is encountered. 

get...byaddr searches the file sequentially from the beginning until a matching address is found, or EOF is encountered. 

get...byport searches the file sequentially from the beginning until a matching port number is found, or EOF is encountered. 

get...bynumber searches the file sequentially from the beginning until a matching protocol number is found, or EOF is encountered. 

Each network library routine returns a pointer to a structure reflecting individual fields of a line in one of the network data base files.  The structure for each data base file contains some of the fields in the following list, with the prefix x replaced by a different letter in each file:

x_addr pointer to a network address, returned in network-byte order

x_addrtype address family of the address being returned

x_aliases alternate names

x_length length of an address, in bytes. 

x_name official name

x_net network number, returned in machine-byte order

x_port resident port

x_proto protocol number

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026