From: Tufan BIYIKTAS (tufan.biyiktas@gmail.com)
Date: Sat 04 Jun 2005 - 01:27:34 EEST
merhabalar,
Interprocess Communications in Linux: The Nooks and Crannies
<a%3E%3C/td%3E%3C/tr%3E%3C/table%3E%3C/td%3E%3Ctd%20width=>
* By John Gray
</authors/bio.asp?a=18a636ad-b14a-403c-9aed-32cf1c3e3221>.
* Published by Prentice Hall PTR <http://www.phptr.com>.
kitabindan ilgili bolumdeki aciklama:
6.5 Message Queue Operations
Message queues are used to send and receive messages. An actual message,
from the system's standpoint, is defined by the msgbuf structure found
in the header file <sys/msg.h> as
struct msgbuf {
long int mtype; /* type of received/sent message */
char mtext[1]; /* text of the message */
};
*This structure is used as a template for the messages to be sent to and
received from the message queue.*
diyor ve ornek verirken;:
typedef struct {
long int msg_to; // Message in queue for this type
long int msg_fm; // Placed in the queue by this type
char buffer[BUFSIZ]; // The actual message
}MESSAGE;
tanimlayip;
MESSAGE msg;
memset(msg.buffer, 0x0, BUFSIZ);
msgsnd(mid, &msg, n, 0) ;
msgrcv(mid, &msg, BUFSIZ, cli_pid, 0);
olarak kullaniyor.
Timur Aydin wrote:
>Tufan BIYIKTAS <tufan.biyiktas@gmail.com> writes:
>
>
>
>>while(1){
>>
>> memset(msg.buffer,0x0,BUFSIZE);
>>
>> msgrcv(msq_id,&msg,len,CLIENT,0);
>>
>>
>
>Linux altinda msgrcv'nin ikinci argumani struct msgbuf* turunden
>olmali. Senin tanimladigin message_t ile struct msgbuf* ayni degil. Bu
>bir problem, ama tek problem bu mu bilemiyorum.
>
>/* Bu senin tanimladigin ve Solaris'deki fonksiyonun beklentilerine
>uygun olmali. */
>typedef struct {
>
> long int msg_to;
> long int msg_fm;
> char buffer[BUFSIZE];
>
>}message_t;
>
>/* Bu da Linux man page'dan */
>struct msgbuf {
> long mtype; /* message type, must be > 0 */
> char mtext[1]; /* message data */
>};
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Linux-programlama mailing list
>Linux-programlama@liste.linux.org.tr
>http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>
>
_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama