HPlogo HP 9000 Networking: BSD Sockets Interface Programmer's Guide > Chapter 1 BSD Sockets Concepts

Introduction

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

This guide describes the steps involved in establishing and using BSD Sockets connections. It also describes the protocols you must use and how the BSD Sockets system calls interact. The details of each system call are described in the corresponding man pages.

Key Terms and Concepts

For a basic understanding of BSD Sockets and its general model, you should review the following terms and definitions.

address family

The address format used to interpret addresses specified in socket operations. The internet address family (AF_INET) and the Berkeley UNIX Domain address family (AF_UNIX) are supported.

addressing

A means of labeling a socket so that it is distinguishable from other sockets on a host.

association

A BSD Sockets connection is defined by an association. An AF_INET association contains the (protocol, local address, local port, remote address, remote port)-tuple. An AF_UNIX association contains the (protocol, local address, peer address)-tuple. Associations must be unique; duplicate associations on the same host cannot exist. The tuple is created when the local and remote socket addresses are bound and connected. This means that the association is created in two steps, and there is a chance that two potential associations could be alike between steps. The host prevents duplicate associations by checking for uniqueness of the tuple at connection time, and reporting an error if the tuple is not unique.

binding

Before a socket can be accessed across the network, it must be bound to an address. Binding associates a socket address with a socket and makes the socket accessible to other sockets on the network. Once a socket address is bound, other sockets can connect to the socket and send data to or receive data from it.

channel

Communication path created by establishing a connection between sockets.

communication domain

A set of properties that describes the characteristics of processes communicating through sockets. The internet (AF_INET) address family domain is supported. The UNIX Domain (AF_UNIX) address family domain is also supported, for local communication only.

internet address

A four-byte address that identifies a node on the network.

message

The data sent in one UDP packet.

packet

A message or data unit that is transmitted between communicating processes.

peer

The remote process with which a process communicates.

port

An address within a host that is used to differentiate between multiple sockets with the same internet address. You can use port address values 1024 through 65535. (Port addresses 1 through 1023 are reserved for the super-user.)

protocols

Two internet transport layer protocols can be used with BSD Sockets. They are TCP, which implements stream sockets, and UDP, which implements datagram sockets.

socket

Sockets are communication endpoints. A pair of connected sockets provides an interface similar to that of HP-UX pipes. A socket is identified by a socket descriptor.

socket address

For the internet address family (AF_INET), the socket address consists of the internet address, port address and address family of a socket. The internet and port address combination allows the network to locate a socket. For UNIX Domain (AF_UNIX), the socket address is the directory pathname bound to the socket.

socket descriptor

A socket descriptor is an HP-UX file descriptor that references a socket instead of an ordinary file. Therefore, it can be used for reading, writing, or most standard file system calls after a BSD Sockets connection is established. System calls that use file descriptors (e.g. read, write, select) can be used with socket descriptors. All BSD Sockets functions use socket descriptors as arguments.

TCP

Provides the underlying communication support for stream sockets. The Transmission Control Protocol (TCP) is used to implement reliable, sequenced, flow-controlled two-way communication based on byte streams similar to pipes. Refer to the tcp(7p) man page for more information on TCP.

UDP

Provides the underlying communication support for datagram sockets. The User Datagram Protocol (UDP) is an unreliable protocol. A process receiving messages on a datagram socket could find messages are duplicated, out-of-sequence, or missing. Messages retain their record boundaries and are sent as individually addressed packets. There is no concept of a connection between the communicating sockets. Refer to the udp(7p) man page for more information on UDP.

UNIX Domain Protocol

In addition, the UNIX Domain protocol may be used with AF_UNIX sockets for interprocess communication on the same node. Refer to the unix(7p) man page for more information on the UNIX Domain protocol.

© 1997 Hewlett-Packard Development Company, L.P.