home *** CD-ROM | disk | FTP | other *** search
-
-
- ---- Running the named pipe program in Unix -----
-
-
- % mknod FrankPIPE p # This makes the named pipe in Unix
- # I'm just using the arbitrary filename 'FrankPIPE'
-
- % ls -l # Note the 'p' for (named) pipe for FrankPIPE
- total 92
- prw-rw-rw- 1 frank 1000 0 Aug 27 14:39 FrankPIPE
- -rwxrwxrwx 1 frank 1000 16836 Aug 27 14:34 client*
- -rw-rw-rw- 1 frank 1000 912 Aug 27 14:34 client.c
- -rwxrwxrwx 1 frank 1000 15828 Aug 27 14:36 daemon*
- -rw-rw-rw- 1 frank 1000 549 Aug 27 14:36 daemon.c
- -rw-rw-rw- 1 frank 1000 110 Aug 27 14:24 local.h
-
- % daemon > logfile &
- 284 <-------------------- The shell prints the pid of the daemon process
-
- % client & client & client &
- 285 <-------------------- The shell prints pids of the 3 client processes
- 286
- 287
-
- % sleep 10; cat logfile
- PID: 286 - string: [Message from a Client]
- PID: 285 - string: [Message from a Client]
- PID: 287 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 287 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 287 - string: [Message from a Client]
- PID: 285 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 285 - string: [Message from a Client]
- PID: 285 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- PID: 285 - string: [Message from a Client]
- PID: 287 - string: [Message from a Client]
- PID: 287 - string: [Message from a Client]
- PID: 286 - string: [Message from a Client]
- Byebye from Daemon <------- I sent a SIGINT signal to a client
-