Notes and Reference
A High level description of Erlang.
Erlang.org tutorial Part 2/4, for the sequential syntax.
Erlang concurrency.
Additional references:
Running code
Ensure that the module name is the same as the file name prefix. For
example, mylist.erl should define the module 'mylist'.
A minimal file: mylist.erl
To compile this file, either compile as
erlc mylist.erl
or invoke the shell with erl and in the
shell, type
c(mylist).
Once the code is compiled, you can run the code by invoking one of
the exported functions, as in:mylist:sum([1,2,3]).
Code Examples
-
A distributed chat server: chat_server_remote.erl
A distributed chat client: chat_client_remote.erl
To run the program, start one session using
erl -name 'remote_node'
and start the server using
>> chat_server_remote:start()
Note that you will need to change the domainname in the code given.
Once the chat server is running, you can run the client using
c(chat_client_local).
and
chat_client_local:start().
- A sample program to test receive with timeout value 0: timeout_test.erl