文档介绍:消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
消息行列通信2”,创立子进度2,子进度2加载服务模块take,该模块显示
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
以下信息:
Pleasetakeyourmoney!
3)等待子进度终止后,server消息对列结束。
注意:1)save和take要预先编译连结好,放在同一目录下;
2)先运行客户端进度,再运行服务端进度。
1、
#include<sys/>
#include<sys/>
#include<sys/>
#include<>
#include<>
#defineMSGKEY75
structmsgform
{longmtype;
charmtext[1000];
}msg;
intmsgqid;
voidclient( )
{
inti;
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
msgqid=msgget(MSGKEY,0777);
/*
翻开
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
75#消息行列
*/
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
for(i=20;i>=1;i--)
{
=i;
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
printf("(client)sent%d\n",i);
sleep(3);
msgsnd(msgqid,&msg,1024,0);
消息*/
}
exit(0);
}
main( )
{
/*
发送
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
client( );
}
#include<sys/>
#include<sys/>
#include<sys/>
#include<>
#include<>
#defineMSGKEY75
structmsgform
{longmtype;
charmtext[1000];
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
}msg;
intmsgqid;
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
voidserver( )
{
msgqid=msgget(MSGKEY,0777|IPC_CREAT);
/*创立75#消息行列*/
do
{
msgrcv(msgqid,&msg,1030,0,0);/*接收消息
*/
printf("(server)received%ld\n",);
sleep(3);
}while(!=1);
msgctl(msgqid,IPC_RMID,0);/*删除消息队
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
列,送还资源
*/
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
exit(0);
}
main( )
{
server( );
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告
}
消息队列通信实验报告
消息队列通信实验报告
消息队列通信实验报告