Will be a support of raw sockets in node.js, e.g. to create ping packets?
3 Answers
A new module named node-raw-socket offers the perfect solution for real raw sockets using nodejs.
And, for creating ping (ICMP) packets, the same developer has a very nice working (using it) solution based on node-raw-sockets as well: node-net-ping.
-
1node-raw-socket does not install. fails on build for me. – uptownhr Sep 23 '15 at 21:09
Node supports TCP, UDP, and unix sockets. Ping packets are ICMP packets, which node cannot create directly at this time. You could execute an external ping
subprocess or consider writing a C extension. Most of node's low level OS APIs are thin javascript wrappers around the corresponding C API, so you could follow that existing well-established pattern and implement this as a small JS wrapper layer around the corresponding OS-level APIs.
http://nodejs.org/docs/latest/api/all.html#all_class_net_socket
There's a chance node/javascript are a poor choice for your project based on this requirement though.

- 142,938
- 30
- 279
- 274
-
1I think the solution should be to create an addon [addons](http://nodejs.org/docs/latest/api/all.html#all_addon_patterns) – sauletasmiestas Dec 10 '12 at 15:25
-
@Peter, There's no reason why Node supports TCP UDP, yet doesn't support IP. Support for IP must come sooner or later. – Pacerier Mar 03 '17 at 23:23