4 Media::Media(key_t key) throw (std::runtime_error)
6 que_id = msgget(key, 0666); // Debe estar previamente creada
8 throw std::runtime_error("No se pudo crear la cola");
11 void Media::transmit(const Frame& frame)
13 std::cout << "tx -> msgtype = " << *(((int*)&frame)+1) << "\n";
14 if (msgsnd(que_id, ((int*)&frame)+1, frame.size(), 0) == -1)
15 throw std::runtime_error("Error al poner en la cola");
18 void Media::receive(Frame& frame)
20 std::cout << "rx -> msgtype = " << *(((int*)&frame)+1) << "\n";
21 if (msgrcv(que_id, ((int*)&frame)+1, frame.size(), frame.mac(), 0) == -1)
22 throw std::runtime_error("Error al sacar de la cola");
25 // vim: set et sw=4 sts=4 :