[so] [tema2][linux]problema sincronizare client-gateway

Drutu Bogdan bogdandrutu at gmail.com
Thu Apr 7 22:28:57 EEST 2011


2011/4/7 Alex Gorunescu <algorunescu at yahoo.com>:
> Hai ca dupa inca o repriza de injuraturi am rezolvat singur problema. Era
> una simpla ca majoritatea bugurilor scarboase.
>
> before:
>
> rez = mq_receive(q_gateway, (char*)&c, sizeof(Command), &prio);
>
> now:
>
> struct mq_attr attr;
> mq_getattr(q_gateway,&attr);
> rez = mq_receive(q_gateway, (char*)&c, attr.mq_msgsize, &prio);
>
> Acum merge si cand face clientul coada.
>
> Alex.

Cred ca ar fi bine ca inainte de a posta un mesaj de genul sa se
citeasca documentatia.
[1] "The msg_len argument specifies the size of the buffer pointed to
by msg_ptr; this must be greater than the mq_msgsize attribute of the
queue (see mq_getattr(3)). If prio is not NULL, then the buffer to
which it points is used to return the priority associated with the
received message. "
>
> _______________________________________________
> http://elf.cs.pub.ro/so/wiki/resurse/lista-discutii
>

[1]http://linux.die.net/man/3/mq_receive

-- 
Bogdan.


More information about the so mailing list