How lib_chan Works

lib_chan is built using code in four modules.

  • lib_chan acts as a “main module.” The only routines that the programmer needs to know about are the routines that are exported from lib_chan. The other three modules (discussed next) are used internally in the implementation of lib_chan.

  • lib_chan_mm encodes and decodes Erlang messages and manages the socket communication.

  • lib_chan_cs sets up the server and manages client connections. One of its primary jobs is to limit the maximum number of simultaneous client connections.

  • lib_chan_auth contains code for simple challenge/response authentication.

lib_chan

lib_chan has the following structure:

 
-module​(lib_chan).
 
 
start_server(ConfigFile) ->
 
%% read configuration file - check ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.