Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 261
Van Coding Avatar asked Nov 14 '22 13:11

Van Coding


1 Answers

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

like image 113
Van Coding Avatar answered Nov 16 '22 18:11

Van Coding