資源簡介
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
評論
共有 條評論