Here we are going to discuss
using more precise language and with more technical details.
,
, and
provide the same functionality with different API.
Of them,
is the oldest and the best known. It is utilized widely. However,
and similar
do not scale well with the number of files, sockets, and other kernel objects that have file descriptors. Even worse,
and
may crash programs. They should not be used in enterprise‑strength codes. It is advisable to replace them at the first opportunity by
,
, or
that are safe.
Communication programming is a fertile field for ambushing bugs, because many things in communication are random and/or are not under programmer control:
Many programmers sooner or later encounter problems with stable production applications that worked fine for months or years. By that time the original developers forgot all details. Or they do not work with the company anymore.
The problems range from subtle to catastrophic. For example, an application may suddenly crash, or refuses to start, or stops accepting user requests.
Modern Linux distros provide POSIX Programmer’s Manual in manpages, sections
,
, and
. You can check if it works on your machine:
123 | man 0p stdio.h
man 1p exit
man 3p open
|
You can consult the POSIX documentation while coding on a beach or in an airplane, without Internet connection. It is always on your fingertips.
People seldom use the command
on Linux machines nowadays. We are accustomed to an equivalent command
,
that for eons was slightly more convenient.
There is a reason, though, to use command
much more often. Especially when we want to figure out something less routine and less obvious.