Socket++ library defines a family of C++ classes that can be used more effectively than directly calling the underlying low-level system functions. One distinct advantage of the socket++ is that it has the same interface as that of the iostream so that the users can perform type-safe input output. See your local IOStream library documentation for more information on iostreams.
streambuf
counterpart of the socket++ is sockbuf
.
sockbuf
is an endpoint for communication with yet another
sockbuf
or simply a socket
descriptor. sockbuf
has also methods that act as interfaces for most of the commonly
used system calls that involve sockets. See sockbuf Class, for more
information on the socket buffer class.
For each communication domain, we derive a new class from sockbuf
that has some additional methods that are specific to that domain. At
present, only unix and inet domains are supported.
sockunixbuf
class and sockinetbuf
class define the unix
and inet domain of sockets respectively. See sockunixbuf Class, for
unix sockets and See sockinetbuf Class, for inet sockets.
We also have domain specific socket address classes that are
derived from a common base class called sockAddr
.
sockunixaddr
class is used for unix domain addresses
and sockinetaddr
class is used for inet domain
addresses. For more information on address classes see sockAddr Class,
sockunixaddr Class, and sockinetaddr Class.
Note:sockAddr
is not spelledsockaddr
in order to prevent name clash with thestruct sockaddr
declared in `<sys/socket.h>
'.
We noted earlier that socket++ provides the same interface as the
iostream library. For example, in the internet domain, we have
isockinet
, osockinet
, and iosockinet
classes
that are counterparts to istream
, ostream
, and
iostream
classes of IOStream library.
For more details on iosockstream
classes see See sockstream Classes.