6 library(socket): Network socket (TCP and UDP) library
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog C-library
        • library(socket): Network socket (TCP and UDP) library
          • Client applications
          • Server applications
          • Socket exceptions
          • TCP socket predicates
          • Unix domain sockets
          • UDP protocol support

6.3 Socket exceptions

Errors that are trapped by the low-level library are mapped to an exception of the shape below. In this term, Code is a lower case atom that corresponds to the C macro name, e.g., epipe for a broken pipe. Message is the human readable string for the error code returned by the OS or the same as Code if the OS does not provide this functionality. Note that Code is derived from a static set of macros that may or may not be defines for the target OS. If the macro name is not known, Code is ERROR_nnn, where nnn is an integer.

error(socket_error(Code, Message), _)

Note that on Windows Code is a wsa* code which makes it hard to write portable code that handles specific socket errors. Even on POSIX systems the exact set of errors produced by the network stack is not defined.