September 2013
Intermediate to advanced
548 pages
12h 25m
English
Now it’s time for the code.
| socket_dist/lib_chan.erl | |
| | -module(lib_chan). |
| | -export([cast/2, start_server/0, start_server/1, |
| | connect/5, disconnect/1, rpc/2]). |
| | -import(lists, [map/2, member/2, foreach/2]). |
| | -import(lib_chan_mm, [send/2, close/1]). |
| | |
| | %%---------------------------------------------------------------------- |
| | %% Server code |
| | |
| | start_server() -> |
| | case os:getenv("HOME") of |
| | false -> |
| | exit({ebadEnv, "HOME"}); |
| | Home -> |
| | start_server(Home ++ "/.erlang_config/lib_chan.conf") |
| | end. |
| | |
| | start_server(ConfigFile) -> |
| | io:format("lib_chan starting:~p~n",[ConfigFile]), |
| | case file:consult(ConfigFile) of |
| | {ok, ConfigData} -> |
| | io:format("ConfigData=~p~n",[ConfigData]), |
| | case ... |
Read now
Unlock full access