1 2 3 4 5 6 7 8 9 10 11 12
| #include "msgcom.h" main(){ struct msgtype buf; int qid,pid; qid=msgget(MSGKEY,IPC_CREAT|0666); buf.mtype=1; buf.text=pid=getpid(); msgsnd(qid,&buf,sizeof(buf.text),IPC_NOWAIT|04000); msgrcv(qid,&buf,512,pid,MSG_NOERROR); printf("Request recived a message from server,type is :%d\n",buf.mtype); }
|