by netgusto · 9y ago · 0 comments
Pretty straightforward to use, at that :
const net = require('net');
const client = new net.Socket();
client.connect(port, host, function() {
client.write("hello !");
});https://en.m.wikipedia.org/wiki/Raw_socket
It does not even offer real access to a TCP socket, for example you can't set any options or flags in the TCP header of a packet. All that it provides is a way to open a socket and send / receive data. Very useful, but not a raw socket.
node core can only tell if a file is a socket, but not read from it, at least that's what the docs say.
for people interested in this: https://github.com/santigimeno/node-unix-stream