Deadlines

First deadline: 15th of October
Final deadline: 19th of October
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!

Arquitecture

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.

Protocol

Code skeleton

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

Requirements

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)
(testsuite@127.0.0.1)1>
# Test: one_client
start server node: Ok
server startup: Ok
start client node client_50150: Ok
client startup client_50150: Ok
client_50150@127.0.0.1 connects to server as user_72305: Ok
client_50150@127.0.0.1 joins #channel_44359: Ok
start client node client_91566: Ok
client startup client_91566: Ok
client_91566@127.0.0.1 connects to server as user_31133: Ok
client_91566@127.0.0.1 joins #channel_44359: Ok
client_50150@127.0.0.1 sends message on #channel_44359: Ok
channel matches: Ok
message matches: Ok
client_91566@127.0.0.1 leaves #channel_44359: Ok
client_50150@127.0.0.1 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@127.0.0.1" -eval "cover:compile_directory(), eunit:test(test_remote), halt()"

Submission

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.