First submission deadline: Wednesday, March 7th 23:59hs
Final submission deadline: Friday, March 13th, 23:59hs
Check how to install Erlang/OTP in your computer!

chat bubbles

Introduction to DCHAT

This lab is basically an adaptation of CCHAT (Lab 3) for a distributed environment. When it comes to make your code distributed, Erlang is pretty good at it. Here, you will put that to the test!


DCHAT will use the same arquitecture as CCHAT, i.e., a client-server architecture. However, now you client process (and the GUI) should be able to communicate with your server located in another Erlang node (maybe in a different computer).

The GUI and the client process

The protocol

As before, the protocol between the GUI and the client process is partly fixed and follows the same scheme as in CCHAT. Below, we briefly describe the extra case.


Code skeleton

You should use the same one given to CCHAT. Here, you can get the code skeleton!


Test cases

Now, your software should pass the same test cases as before together with some extra ones designed to check if you adapted your code to work in a distributed environment. The test cases are given in the same testing framework (eunit) as we did previously.

The distributed tests are contained in the file test_remote.erl (there is currently only one test case). To run these tests, make sure to get the latest version of the code skeleton and execute the following:

$ make -s run_distributed_tests

You should see the following output:

$ make -s run_distributed_tests
Erlang R16B03 (erts-5.10.4) [source] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
# Test: one_client
start server node: Ok
server startup: Ok
start client node client_50150: Ok
client startup client_50150: Ok
client_50150@ connects to server as user_72305: Ok
client_50150@ joins #channel_44359: Ok
start client node client_91566: Ok
client startup client_91566: Ok
client_91566@ connects to server as user_31133: Ok
client_91566@ joins #channel_44359: Ok
client_50150@ sends message on #channel_44359: Ok
channel matches: Ok
message matches: Ok
client_91566@ leaves #channel_44359: Ok
client_50150@ sends message on #channel_44359: Ok
no more messages: Ok
  Test passed.

If you have added extra modules, make sure that they are also compiled (e.g. by adding them to the makefile).

Alternatives to make

If your system doesn't have the make command, you can run the test suite like so:

$ killall beam.smp
$ erl -name "testsuite@" -eval "cover:compile_directory(), eunit:test(test_remote), halt()"


You should submit your code based on the skeleton code and whatever other files are needed for your solution to work. In addition, you should comment your code so that graders can easily review your submission.