91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 17.73MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-08-04
  • 語言: 其他
  • 標(biāo)簽: 進(jìn)程通信??

資源簡介

編寫兩個(gè)進(jìn)程,一進(jìn)程負(fù)責(zé)發(fā)送字符 串,另一進(jìn)程負(fù)責(zé)接收字符串; 支持Windows/linux的共享存儲(chǔ)區(qū)、消息、有名和無名管道、Socket通信 發(fā)送進(jìn)程應(yīng)可以從窗口或鍵盤上接收字符串; 接收進(jìn)程應(yīng)可將字符串顯示在窗口上;

資源截圖

代碼片段和文件信息

/************?
?*?MsgQue.c?*
?************/

#include?
#include?
#include?
#include?
#include?
#include?

#define?MAX_SEND_SIZE?80

struct?mymsgbuf?{
long?mtype;
char?mtext[MAX_SEND_SIZE];
};

void?send_message(int?qid?struct?mymsgbuf?*qbuf?long?type?char?*text);
void?read_message(int?qid?struct?mymsgbuf?*qbuf?long?type);
void?remove_queue(int?qid);
void?change_queue_mode(int?qid?char?*mode);
void?usage(void);


int?main(int?argc?char?*argv[])
{
key_t?key;
int?msgqueue_id;
struct?mymsgbuf?qbuf;

if(argc?==?1)
usage();

/*?Create?unique?key?via?call?to?ftok()?*/
/*?key?=?ftok(“.“?‘w‘);?*/?
key?=?123456;
printf(“key=%d\n“key);
key=IPC_PRIVATE;
/*?Open?the?queue?-?create?if?necessary?*/

if((tolower(argv[1][0]))!=‘s‘)
{
if((msgqueue_id?=?msgget(key?IPC_CREAT|0666))?==?-1)?{
perror(“msgget“);
exit(1);
}
printf(“msgqueue_id=%d\n“msgqueue_id);
}

switch(tolower(argv[1][0]))
{
case?‘s‘:?send_message(atoi(argv[4])?(struct?mymsgbuf?*)&qbuf
atol(argv[2])?argv[3]);?
break;
case?‘r‘:?read_message(msgqueue_id?&qbuf?atol(argv[2]));?
break;
case?‘d‘:?remove_queue(atoi(argv[2]));?
remove_queue(msgqueue_id);
break;?
case?‘m‘:?change_queue_mode(msgqueue_id?argv[2]);?
break;

default:?usage();

}

return(0);
}

void?send_message(int?qid?struct?mymsgbuf?*qbuf?long?type?char?*text)
{
printf(“msgqueue_id=%d\n“qid);
/*?Send?a?message?to?the?queue?*/
printf(“Sending?a?message?...\n“);
qbuf->mtype?=?type;
strcpy(qbuf->mtext?text);
printf(“?Type:?%ld?Text:?%s\n“?qbuf->mtype?qbuf->mtext);

if((msgsnd(qid?(struct?msgbuf?*)qbuf
strlen(qbuf->mtext)+1?0))?==-1)
{
perror(“msgsnd“);
exit(1);
}
}

void?read_message(int?qid?struct?mymsgbuf?*qbuf?long?type)
{
/*?Read?a?message?from?the?queue?*/
printf(“Reading?a?message?...\n“);
qbuf->mtype?=?type;
msgrcv(qid?(struct?msgbuf?*)qbuf?MAX_SEND_SIZE?type?0);

printf(“?Type:?%ld?Text:?%s\n“?qbuf->mtype?qbuf->mtext);
}

void?remove_queue(int?qid)
{
/*?Remove?the?queue?*/
msgctl(qid?IPC_RMID?0);
}

void?change_queue_mode(int?qid?char?*mode)
{
struct?msqid_ds?myqueue_ds;

/*?Get?current?info?*/
msgctl(qid?IPC_STAT?&myqueue_ds);

/*?Convert?and?load?the?mode?*/
sscanf(mode?“%ho“?&myqueue_ds.msg_perm.mode);

/*?Update?the?mode?*/
msgctl(qid?IPC_SET?&myqueue_ds);
}

void?usage(void)
{
fprintf(stderr?“msgtool?-?A?utility?for?tinkering?with?msg?queues\n“);
fprintf(stderr?“\nUSAGE:?msgtool?(s)end???\n“);
fprintf(stderr?“?(r)ecv?\n“);
fprintf(stderr?“?(d)elete\n“);
fprintf(stderr?“?(m)ode?\n“);
fprintf(stderr?“note:?type?must?be?number!\n“);
exit(1);
}?

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????2654??2010-07-08?22:51??源代碼\linux進(jìn)程通信\message\MsgQue.c

?????文件???????1200??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\apptest.c

?????文件???????1058??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\fifo_open_test.c

?????文件????????953??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\fifo_w_test_1.c

?????文件????????836??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\fifo_w_test_2.c

?????文件???????3358??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\plot.c

?????文件????????847??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\readtest.c

?????文件????????655??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\writetest1.c

?????文件????????776??2010-07-08?22:51??源代碼\linux進(jìn)程通信\pipe\writetest2.c

?????文件????????688??2010-07-08?22:51??源代碼\linux進(jìn)程通信\sharememory\shm.c

?????文件????????760??2010-07-08?22:51??源代碼\linux進(jìn)程通信\sharememory\shmread.c

?????文件????????786??2010-07-08?22:51??源代碼\linux進(jìn)程通信\sharememory\shmwrite.c

?????文件????????896??2010-07-08?22:51??源代碼\linux進(jìn)程通信\socket\client.c

?????文件???????1353??2010-07-08?22:51??源代碼\linux進(jìn)程通信\socket\server.c

?????文件??????53544??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.aps

?????文件???????1319??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.clw

?????文件???????2194??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.cpp

?????文件???????4437??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.dsp

?????文件????????535??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.dsw

?????文件???????1371??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.h

?????文件???12782592??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.ncb

?????文件?????129024??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.opt

?????文件????????741??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.plg

?????文件???????5661??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.rc

?????文件????????334??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.sln

?????文件???????1415??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Client.vcproj.wqlong-PC.wqlong.user

?????文件???????5869??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\ClientDlg.cpp

?????文件???????1603??2010-07-08?22:50??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\ClientDlg.h

?????文件????3130368??2010-07-08?22:51??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Debug\Client.bsc

?????文件?????143477??2010-07-08?22:51??源代碼\windows進(jìn)程通信\進(jìn)程通信\Client\Debug\Client.exe

............此處省略94個(gè)文件信息

評論

共有 條評論