It is currently Fri, 22 Aug 2014 16:35:07 GMT



 
Author Message
 mkfifo example code

I want to set up a uni-directional message stream between a server
process and several unrelated client processes.

I'm keen to implement this using fifo piping. Can anyone point me in the
direction of any resources on this subject on the web (ie. example code)?

Cheers,

Richard Mundell
---
  Your eyes are weary from staring at the CRT.  You feel sleepy.  Notice how
   restful it is to watch the cursor blink.  Close your eyes.  The opinions
   stated above are yours.  You cannot imagine why you ever felt otherwise.

     Richard Mundell, SYS, University of East Anglia, Norwich, England
     r.mund...@uea.ac.uk http://www.**-**.com/ ~u9427082/Photo.html



 Wed, 23 Jun 1999 03:00:00 GMT   
 mkfifo example code

Here it is:

/*
 * mkfifo.c
 *
 * makes a fifo (named pipe)
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>

int main( int argc, char **argv )
{
  mode_t mode;

  if( argc < 2 ) {
    fprintf( stderr, "USAGE:  %s <fifoname> [<mode>]\n", argv[0] );
    exit(1);
  }

  if( argc < 3 ) {
    mode = 0777;
  } else {
    mode = atoi( argv[2] );
  }

  if( mkfifo( argv[1], mode ) == -1 ) {
    perror( "Mkfifo failed" );
    exit(1);
  }

  return 0;

This program creates a fifo in the filesystem. You can use it by
opening it for read on one end and open it for write on the other,
just as you would do for an ordinary file.

Leon.
--
Windows No Thanks!



 Thu, 24 Jun 1999 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. Need example of mkfifo()

2. code example for set a ARP entry (error, )

3. decnet example code?

4. TCP/IP client/server code examples.

5. IP_PKTINFO / in_pktinfo -- Code example?

6. Example code for packet sockets wanted

7. SunOne directory+Calendar server code examples?

8. Solaris Multicast example code

9. Looking for XDMCP direct example code

10. : Looking for serial STOP-A source code example


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software