2023-05-14 18:03:50 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ipc.h>
|
2023-05-14 21:44:03 +02:00
|
|
|
#include <sys/shm.h>
|
2023-05-14 18:03:50 +02:00
|
|
|
|
2023-05-14 18:10:44 +02:00
|
|
|
#include <server.h>
|
|
|
|
#include <structures.h>
|
2023-05-15 10:31:50 +02:00
|
|
|
#include <custom_sem.h>
|
2023-05-15 10:43:25 +02:00
|
|
|
#include <custom_shm.h>
|
2023-05-14 17:07:34 +02:00
|
|
|
|
2023-05-14 18:03:50 +02:00
|
|
|
|
2023-05-14 17:07:34 +02:00
|
|
|
int main(int argc, char *argv[]){
|
2023-05-14 18:08:10 +02:00
|
|
|
input_server_t input = check_input(argc, argv);
|
2023-05-14 18:03:50 +02:00
|
|
|
|
2023-05-15 10:43:25 +02:00
|
|
|
int shmBoardid = getShmid(input.rows, input.collums);
|
2023-05-14 22:04:24 +02:00
|
|
|
tile_t *board = shmServerAt(shmBoardid);
|
|
|
|
|
2023-05-15 10:31:50 +02:00
|
|
|
// si potrebbe mettere in server.c
|
|
|
|
int semid = getSemid(ftok(KEYFILE, 'k'), 2);
|
|
|
|
|
2023-05-15 10:43:25 +02:00
|
|
|
resetServerSem(semid);
|
|
|
|
|
2023-05-15 10:52:18 +02:00
|
|
|
semOp(semid, 0, 2); // aperurta semaforo per connessione dei due client
|
|
|
|
semOp(semid, 0, 0); // aspetto che si connettano i due client
|
2023-05-14 22:13:42 +02:00
|
|
|
|
2023-05-14 17:07:34 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|