当前位置: 技术问答>linux和unix
消息队列
来源: 互联网 发布时间:2016-12-19
本文导语: app3.c int main(int argc ,int argv[]) { int msgid5; int msgid3; int i; int ret; int len; int len1; unsigned char sendbuff[20]={0xFE,0xFE,0xFE,0xFE,0x68, 0x89,0x67,0x45,0x23,0x01, ...
app3.c
int main(int argc ,int argv[])
{
int msgid5;
int msgid3;
int i;
int ret;
int len;
int len1;
unsigned char sendbuff[20]={0xFE,0xFE,0xFE,0xFE,0x68,
0x89,0x67,0x45,0x23,0x01,
0x00,0x68,0x11,0x04,0x33,
0x32,0x34,0x33,0x0A,0x16 };
char recv_buff[40];
mkdir("zzz",0777);
mkdir("zzz1",0777);
msgid3 = creat_msg_queue(zzz);
msgid5 = creat_msg_queue(zzz1);
for(i = 1;i0)){
printf("app3fasongn");
}
if((len1==recv_msg(msgid5,0x11,recv_buff))>0)
{
printf("app3jieshoun");
}
}
app5.c:
int main(int argc ,int argv[])
{
int msgid5;
int msgid3;
int i;
int ret;
char recv_buff[21];
int len;
int len1;
mkdir("zzz",0777);
mkdir("zzz1",0777);
msgid3 = creat_msg_queue(zzz);
msgid5 = creat_msg_queue(zzz1);
char send_buff[40]={0xFE,0xFE,0xFE,0xFE,0x68,
0x89,0x67,0x45,0x23,0x01,
0x00,0x68,0x91,0x18,0x33,
0x32,0x34,0x33,0x3C,0x35,
0x33,0x33,0x95,0x33,0x33,
0x33,0x99,0x33,0x33,0x33,
0x44,0x33,0x33,0x33,0x9B,
0x33,0x33,0x33,0xE6,0x16 };
if ((len ==recv_msg(msgid3,0x11,recv_buff))>0)
{
printf("app5jieshoun");
}
if ((len1==send_msg(msgid5,send_buff,0x11,40))>0)
{
printf("app5fangsongn");
}
为什么先运行APP3后运行APP5,再运行APP3,APP3还是收不到数据呢,只有多运行几次APP5,APP3才收的到消息
int main(int argc ,int argv[])
{
int msgid5;
int msgid3;
int i;
int ret;
int len;
int len1;
unsigned char sendbuff[20]={0xFE,0xFE,0xFE,0xFE,0x68,
0x89,0x67,0x45,0x23,0x01,
0x00,0x68,0x11,0x04,0x33,
0x32,0x34,0x33,0x0A,0x16 };
char recv_buff[40];
mkdir("zzz",0777);
mkdir("zzz1",0777);
msgid3 = creat_msg_queue(zzz);
msgid5 = creat_msg_queue(zzz1);
for(i = 1;i0)){
printf("app3fasongn");
}
if((len1==recv_msg(msgid5,0x11,recv_buff))>0)
{
printf("app3jieshoun");
}
}
app5.c:
int main(int argc ,int argv[])
{
int msgid5;
int msgid3;
int i;
int ret;
char recv_buff[21];
int len;
int len1;
mkdir("zzz",0777);
mkdir("zzz1",0777);
msgid3 = creat_msg_queue(zzz);
msgid5 = creat_msg_queue(zzz1);
char send_buff[40]={0xFE,0xFE,0xFE,0xFE,0x68,
0x89,0x67,0x45,0x23,0x01,
0x00,0x68,0x91,0x18,0x33,
0x32,0x34,0x33,0x3C,0x35,
0x33,0x33,0x95,0x33,0x33,
0x33,0x99,0x33,0x33,0x33,
0x44,0x33,0x33,0x33,0x9B,
0x33,0x33,0x33,0xE6,0x16 };
if ((len ==recv_msg(msgid3,0x11,recv_buff))>0)
{
printf("app5jieshoun");
}
if ((len1==send_msg(msgid5,send_buff,0x11,40))>0)
{
printf("app5fangsongn");
}
为什么先运行APP3后运行APP5,再运行APP3,APP3还是收不到数据呢,只有多运行几次APP5,APP3才收的到消息
|
问一下你这 *_msg的api是不是自己封装的?
其次一个显而易见的错误:
应该是=
其次一个显而易见的错误:
if ((len ==recv_msg(msgid3,0x11,recv_buff))>0)
{
printf("app5jieshoun");
}
if ((len1==send_msg(msgid5,send_buff,0x11,40))>0)
{
printf("app5fangsongn");
}
应该是=
|
CSDN 这文字编辑器做的真是了得 无语
if ((len ==recv_msg(msgid3,0x11,recv_buff))>0)
{
printf("app5jieshoun");
}
应该是=
if ((len ==recv_msg(msgid3,0x11,recv_buff))>0)
{
printf("app5jieshoun");
}
应该是=
|
当然有