- Initial init-set-get service
- Distributed service based on mqueue (POSIX queue)
- Distributed service based on sockets
$ cd centralized
$ make
gcc -g -Wall -c app-c.c
gcc -g -Wall -c lib.c
gcc -g -Wall app-c.o lib.o -o app-c
$ ./app-c
set("nombre", 1, 0x123)
get("nombre", 1) -> 0x123
sequenceDiagram
app-c ->> lib.c: request lib.h API
lib.c ->> app-c: return result of API call
$ cd distributed-mqueue
$ make
gcc -g -Wall -c app-d.c
gcc -g -Wall -c lib-client.c
gcc -g -Wall -c lib.c
gcc -g -Wall -lrt app-d.o lib.o lib-client.o -o app-d -lrt
gcc -g -Wall -c lib-server.c
gcc -g -Wall lib.o lib-client.o lib-server.o -o lib-server -lrt
TIP: POSIX queues are used for communicating processes in the same machine
Step | Client | Server |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
TIP: POSIX queues can be visible from command line:
sudo mkdir /dev/mqueue
sudo mount -t mqueue none /dev/mqueue
ls -las /dev/mqueue
sequenceDiagram
app-d ->> lib-client.c: request lib.h API in a distributed way
lib-client.c ->> lib-server.c: request remote API
lib-server.c ->> lib.c: request lib.h API call
lib.c ->> lib-server.c: return API call result
lib-server.c ->> lib-client.c: return remote result
lib-client.c ->> app-d: return result of the distributed API call
TIP: Before execute in two different machine please update the server IP address in lib-client.c
$ cd distributed-sockets
$ make
gcc -g -Wall -c app-d.c
gcc -g -Wall -c lib-client.c
gcc -g -Wall -c lib.c
gcc -g -Wall app-d.o lib.o lib-client.o -o app-d
gcc -g -Wall -c lib-server.c
gcc -g -Wall lib.o lib-client.o lib-server.o -o lib-server
Step | Client | Server |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
sequenceDiagram
app-d ->> lib-client.c: request lib.h API in a distributed way
lib-client.c ->> lib-server.c: request remote API
lib-server.c ->> lib.c: request lib.h API call
lib.c ->> lib-server.c: return API call result
lib-server.c ->> lib-client.c: return remote result
lib-client.c ->> app-d: return result of the distributed API call