#include <QCoreApplication>
#include "appserver.h"
#include "../ytDMPServerDog/dogshm.h"
ServerDogShm *dogshm;

bool load_shm()
{
    int shmid;
    key_t key;
    if((key=ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1){
        return false;
    }
    if((shmid=shmget(key,sizeof(ServerDogShm),IPC_CREAT|0666))==-1){
        return false;
    }
    dogshm=static_cast<ServerDogShm*>(shmat(shmid,nullptr,0));

    return true;
}


int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    if(load_shm()){
        AppServer *server = new AppServer(nullptr);
        server->start();
    }

    return a.exec();
}
