How to create a pipe file ("mkfifo pipe_file")

  • Thread starter Iñaki Baz Castillo
  • Start date
I

Iñaki Baz Castillo

Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

Thanks.

=2D-=20
I=C3=B1aki Baz Castillo <[email protected]>
 
I

Iñaki Baz Castillo

El Jueves, 7 de Enero de 2010, I=C3=B1aki Baz Castillo escribi=C3=B3:
Hi, I don't find the appropriate command to create a "pipe" file in Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

By the way, is it better to use a pipe_file or a UNIX socket? both are IO=20
objects but, is there any advantage in using some of them?

Thanks.

=2D-=20
I=C3=B1aki Baz Castillo <[email protected]>
 
R

Robert Klemme

El Jueves, 7 de Enero de 2010, Iñaki Baz Castillo escribió:

By the way, is it better to use a pipe_file or a UNIX socket? both are IO
objects but, is there any advantage in using some of them?

It depends on your usage model: if you need to know every individual
client then you need to use a socket. If you just can read message
after message from wherever it came you can use a named pipe. Also,
IIRC a named pipe signals EOF once a writer has closed its end. So both
have a quite different usage model...

Kind regards

robert
 
I

Iñaki Baz Castillo

El Jueves, 7 de Enero de 2010, Robert Klemme escribi=F3:
=20
It depends on your usage model: if you need to know every individual
client then you need to use a socket.
If you just can read message after message from wherever it came you can = use
a named pipe.

Yes, this is my case :)








=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
E

Eleanor McHugh

Hi, I don't find the appropriate command to create a "pipe" file in = Ruby.
Which is the command to behave as system "mkfifo pipe_file"?

I see you've been asking a lot of questions over the Xmas break which =
seem to amount to "how the heck do I tame Unix from Ruby". Whilst =
they're by no means the full answer, take a look at the "Ruby Plumber's =
Guide" presentations linked from my sig and google the couple of videos =
that accompany them (there's one from GoRuCo, another from Rails =
Underground, and possibly others too).

There should be enough between them to give you an idea of how to use =
Unix system calls from standard Ruby with syscall and Ruby/DL (or with a =
bit of thought from Ruby/FFI).

Also grab yourself a copy of Marc Rochkind's "Advanced Unix Programming" =
and then spend a few days with the man pages for your favourite Unix =
distro. Whilst the POSIX calls have the advantage of being fairly =
portable you'll find most platforms have some cool calls of their own.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 
I

Iñaki Baz Castillo

El Viernes, 8 de Enero de 2010, Eleanor McHugh escribi=F3:
=20
I see you've been asking a lot of questions over the Xmas break which seem
to amount to "how the heck do I tame Unix from Ruby". Whilst they're by = no
means the full answer, take a look at the "Ruby Plumber's Guide"
presentations linked from my sig and google the couple of videos that
accompany them (there's one from GoRuCo, another from Rails Underground,
and possibly others too).
=20
There should be enough between them to give you an idea of how to use Unix
system calls from standard Ruby with syscall and Ruby/DL (or with a bit = of
thought from Ruby/FFI).
=20
Also grab yourself a copy of Marc Rochkind's "Advanced Unix Programming"
and then spend a few days with the man pages for your favourite Unix
distro. Whilst the POSIX calls have the advantage of being fairly portab= le
you'll find most platforms have some cool calls of their own.

Thanks a lot, I'm already reading such documentation :)


=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
E

Eleanor McHugh

El Viernes, 8 de Enero de 2010, Eleanor McHugh escribi=F3:
=20
Thanks a lot, I'm already reading such documentation :)


I should add that there's also a wealth of useful code lurking on Github =
- especially amongst Ara T. Howard's stuff.

Oh, and despite what the docs might say it seems to be perfectly safe =
(at least under mainstream Unix implementations) to load libc with =
either Ruby/DL or Ruby-FFI :)


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top