OSSP   OpenPKG   net.sw   ePaperwork   
OSSP sa OSSP - Unix Software Technologies

Socket Abstraction


OSSP sa is an abstraction library for the Unix socket application programming interface (API) featuring stream and datagram oriented communication over Unix Domain and Internet Domain (TCP and UDP) sockets. It provides the following key features: address abstraction (local, IPv4, and IPv6), type abstraction, I/O timeouts, I/O stream buffering and convenience I/O functions. It provides the following key features:
  • Stand-Alone, Self-Contained, Embeddable
    Although there are various Open Source libraries available which provide a similar abstraction approach, they all either lack important features or unfortunately depend on other companion libraries. OSSP sa fills this gap by providing all important features (see following points) as a stand-alone and fully self-contained library. This way OSSP sa can be trivially embedded as a sub-library into other libraries. It especially provides additional support for namespace-safe embedding of its API in order to avoid symbol conflicts.

  • Address Abstraction
    Most of the ugliness in the Unix Socket API is the necessity to have to deal with the various address structures (struct sockaddr_xx) which exist because of both the different communication types and addressing schemes. OSSP sa fully hides this by providing an abstract and opaque address type (sa_addr_t) together with utility functions which allow one to convert from the traditional struct sockaddr or URI specification to the sa_addr_t and vice versa without having to deal with special cases related to the underlying particular struct sockaddr_xx. OSSP sa support Unix Domain and both IPv4 and IPv6 Internet Domain addressing.

  • Type Abstraction
    Some other subtle details in the Unix Socket API make the life hard in practice: socklen_t and ssize_t. These two types originally were (and on some platforms still are) plain integers or unsigned integers while POSIX later introduced own types for them (and even revised these types after some time again). This is nasty, because for 100% type-correct API usage (especially important on 64-bit machines where pointers to different integer types make trouble), every application has to check whether the newer types exists, and if not provide own definitions which map to the still actually used integer type on the underlying platform. OSSP sa hides most of this in its API and for socklen_t provides a backward-compatibility definition. Instead of ssize_t it can use size_t because OSSP sa does not use traditional Unix return code semantics.

  • I/O Timeouts
    Each I/O function in OSSP sa is aware of timeouts (set by sa_timeout(3)), i.e., all I/O operations return SA_ERR_TMT if the timeout expired before the I/O operation was able to succeed. This allows one to easily program less-blocking network services. OSSP sa internally implements these timeouts either through the SO_{SND,RCV}TIMEO feature on more modern Socket implementations or through traditional select(2). This way high performance is achieved on modern platforms while the full functionality still is available on older platforms.

  • I/O Stream Buffering
    If OSSP sa is used for stream communication, internally all I/O operations can be performed through input and/or output buffers (set by sa_buffer(3)) for achieving higher I/O performance by doing I/O operations on larger aggregated messages and with less required system calls. Additionally if OSSP sa is used for stream communication, for convenience reasons line-oriented reading (sa_readln(3)) and formatted writing (see sa_writef(3)) is provided, modelled after STDIO's fgets(3) and fprintf(3). Both features fully leverage from the I/O buffering.


sa(3) , sa-config(1) .


Ralf S. Engelschall <rse@engelschall.com>


Stable Version:  1.2.6 (03-Oct-2005)   [Bug Reporting]
Genesis:  Jan-2001



ChangeLog: http://cvs.ossp.org/pkg/lib/sa/ChangeLog
Repository: http://cvs.ossp.org/pkg/lib/sa/
Distribution: ftp://ftp.ossp.org/pkg/lib/sa/

Distribution Files: Size: Time:
sa-1.2.6.tar.gz     338.6KB   03-Oct-2005
sa-1.2.5.tar.gz     338.6KB   02-Oct-2005
sa-1.2.4.tar.gz     330.1KB   29-Jan-2005
sa-1.2.3.tar.gz     329.9KB   24-Jan-2005
sa-1.2.2.tar.gz     325.8KB   26-Jun-2004
sa-1.2.1.tar.gz     322.8KB   11-Jun-2004
sa-1.2.0.tar.gz     322.2KB   02-Apr-2004
sa-1.1.0.tar.gz     318.6KB   10-Nov-2003
sa-1.0.5.tar.gz     225.5KB   31-Jan-2003
sa-1.0.4.tar.gz     225.3KB   28-Jan-2003
sa-1.0.3.tar.gz     225.2KB   06-Jan-2003
sa-1.0.2.tar.gz     224.9KB   04-Dec-2002
sa-1.0.1.tar.gz     223.1KB   07-Nov-2002
sa-1.0.0.tar.gz     222.5KB   01-Nov-2002
sa-0.9.3.tar.gz     222.3KB   30-Oct-2002
sa-0.9.2.tar.gz     210.6KB   11-Oct-2002
sa-0.9.1.tar.gz     208.4KB   15-Mar-2002
sa-0.9.0.tar.gz     200.8KB   31-Jan-2002


OSSP sa is a sub-project of OSSP and hence a fully non-profit Open Source Software effort. The development on OSSP projects like OSSP sa is supported by the contributions and sponsoring of individuals and companies. You can support OSSP sa and the other OSSP projects yourself by contributing source fixes and enhancements or by donating money. To reward the efforts on OSSP sa, just press the button to the right to perform a secure PayPal online money transaction to the OSSP project. Credit will be given to you on the OSSP Sponsors page once your donation was received.     
GNU pth
OSSP fsl
OSSP var
OSSP val
OSSP xds
OSSP str
OSSP uuid
OSSP sio
OSSP cfg
OSSP act
OSSP cache
OSSP path
OSSP proc
OSSP pcbe
OSSP res
OSSP hook
OSSP mux
OSSP err
OSSP popt
OSSP pcre
OSSP adns