°£´ÜÇÑ ¼¹ö ÇÁ·Î¼¼½º¸¦ »ìÆ캸ÀÚ:
/***************************************************************************** ¸®´ª½º ÇÁ·Î±×·¡¸Ó¸¦ À§ÇÑ °¡À̵å - 6Àå ¿¡¼ ¹ßÃé (C)opyright 1994-1995, Scott Burkett ***************************************************************************** MODULE: fifoserver.c *****************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> #include <linux/stat.h> #define FIFO_FILE "MYFIFO" int main(void) { FILE *fp; char readbuf[80]; /*ÆÄÀÌÇÁ°¡ Á¸ÀçÇÏÁö ¾ÊÀ¸¸é ¸¸µç´Ù*/ umask(0); mknod(FIFO_FILE, S_IFIFO|0666, 0); while(1) { fp = fopen(FIFO_FILE, "r"); fgets(readbuf, 80, fp); printf("Received string: %s\n", readbuf); fclose(fp); } return(0); }µðÆúÆ®·Î FIFO´Â Â÷´ÜµÊÀ¸·Î, ÄÄÆÄÀÏÇÑ ÈÄ¿¡ ¹é±×¶ó¿îµå·Î server¸¦ ½ÇÇà½ÃÄѶó:
$ fifoserver&Àá½Ã FIFOÀÇ Â÷´Ü µ¿ÀÛ¿¡ ´ëÇØ ¸»ÇÏ°Ú´Ù. ¸ÕÀú, ¼¹ö¿¡ ´ëÇÑ ´ÙÀ½ÀÇ °£´ÜÇÑ Å¬¶óÀ̾ðÆ® º¯È¯ºÎ(frontend)¸¦ »ìÆ캸ÀÚ:
/***************************************************************************** ¸®´ª½º ÇÁ·Î±×·¡¸Ó¸¦ À§ÇÑ °¡À̵å - 6Àå ¿¡¼ ¹ßÃé (C)opyright 1994-1995, Scott Burkett ***************************************************************************** MODULE: fifoclient.c *****************************************************************************/ #include <stdio.h> #include <stdlib.h> #define FIFO_FILE "MYFIFO" int main(int argc, char *argv[]) { FILE *fp; if ( argc != 2 ) { printf("USAGE: fifoclient [string]\n"); exit(1); } if((fp = fopen(FIFO_FILE, "w")) == NULL) { perror("fopen"); exit(1); } fputs(argv[1], fp); fclose(fp); return(0); }
Copyright (c) 1996,1997 by Euibeom.Hwang & SangEun.Oh All Rights Reserved
Email To:Webmaster ,
Another address
LAST UPDATE Nov 15,1997
Created Nov 15,1997