by wfunction · 9y ago · 0 comments
Sure browsers don't have a js raw socket API, but no browsers are involved in this thing.
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.