Van Coding
Van Coding

Reputation: 24524

node.js get file descriptor of socket?

How can I get the file descriptor (respectively its path) of a socket?

I can open a file descriptor when I know its path like this:

var fd = require("fs").createReadStream(pathOfFileDescriptor);

for example

require("fs").createReadStream("/proc/"+process.pid+"/fd/0").on("data",function(d){
    console.log("The following data comes from stdin: "+d);
});

Now, how can I know which file descriptor file is for which socket?

Hope someone can help!

Upvotes: 5

Views: 1781

Answers (1)

Van Coding
Van Coding

Reputation: 24524

This seems not to be possible at the moment. Maybe it will come in future versions of node.js

Upvotes: 1

Related Questions