资源简介

Linux下6种进程间通信的服务端和客户端实例。

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 
#include 

#define FIFO_NAME “FIFO“

int main(int argc char **argv)
{
int fd;
if(argc < 2) {
printf(“argc error!\n“);
exit(-1);
}

if((fd = open(FIFO_NAME O_RDWR)) < 0) {
perror(“open“);
exit(-1);
}
char buf[1024];
strcpy(buf argv[1]);
if(write(fd buf sizeof(buf)) < 0) {
perror(“write“);
exit(-1);
}
printf(“write argv[1] = %s\n“ argv[1]);

return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-11-26 21:55  myIPC\
     文件         497  2013-10-02 10:34  myIPC\fifo_cli.c
     文件         429  2013-10-02 10:34  myIPC\fifo_ser.c
     文件        1918  2013-10-02 10:34  myIPC\msg.c
     文件        1090  2013-10-02 10:34  myIPC\msg_cli.c
     文件        1057  2013-10-02 10:34  myIPC\msg_ser.c
     文件        1260  2013-10-07 00:21  myIPC\mutex.c
     文件        1260  2013-10-07 00:21  myIPC\mutex.c.bak
     文件         501  2013-10-02 10:34  myIPC\myshm_cli.c
     文件         650  2013-10-02 10:46  myIPC\myshm_ser.c
     文件         629  2013-10-02 10:34  myIPC\myshm_ser.c.bak
     文件         437  2013-10-02 10:34  myIPC\pipe.c
     文件        2706  2013-10-02 10:34  myIPC\read_shm.c
     文件         481  2013-10-02 10:34  myIPC\shm_read.c
     文件         395  2013-10-02 10:34  myIPC\shm_write.c
     文件         832  2013-10-02 10:34  myIPC\sigaction.c
     文件         865  2013-10-05 13:24  myIPC\thread.c
     文件        1106  2013-10-06 10:42  myIPC\thread_sem.c
     文件        1043  2013-10-05 13:53  myIPC\thread_sem.c.bak
     文件        3013  2013-10-02 10:34  myIPC\write_shm.c

评论

共有 条评论