server.listenFD support - how to use named pipes

1,666 views
Skip to first unread message

Thomas Fritz

unread,
Oct 10, 2011, 4:40:18 PM10/10/11
to nodejs list
Hello

I just wanted to try out named pipes (FIFOs) and came across
server.listenFD. It seems that it is not implemented for now.
My question is. How will named pipes be implemented and work in
node.js in the future (i think i have read about named pipe support in
node).

I have not worked with named pipes so far but know what they are, for
what and when they should be used (at least theoretically), so please
forgive my ignorance.
What i have done so far is "mkfifo test_pipe"

in Node i tried this:

var fs = require("fs");
var net = require("net");

fs.open(__dirname + "/test_pipe", "r", function(err, fd) {
if(err) console.error(err);
console.log("fs.open", arguments);
var server = net.createServer(function(c) {
console.log("createServer", arguments);
});
server.listenFD(fd, function() {
console.log("listenFd", arguments);
});
});

I have no idea if i am using this as it is intended to use, so please
could someone give me an example of how listenFD WILL work as soon as
it is implemented? Or what is meant with "Non-blocking named pipes" on
this blog post http://blog.nodejs.org/2011/09/23/libuv-status-report/
?

Will it be possible to create FIFOs from within node.js?

Kind regards

---
Thomas FRITZ
web http://fritzthomas.com
twitter http://twitter.com/thomasf

Ben Noordhuis

unread,
Oct 10, 2011, 5:11:32 PM10/10/11
to nod...@googlegroups.com

Windows has a concept of named pipes but since you mention `mkfifo` I
assume you mean UNIX FIFOs.

We don't support them and probably never will (FIFOs in non-blocking
mode have the potential to deadlock the event loop) but you can use
UNIX sockets if you need similar functionality.

Reply all
Reply to author
Forward
0 new messages