简体   繁体   English

在Node.js中使用自定义传输层协议

[英]Use custom transport layer protocol in Node.js

I've wanted to experiment with creating a transport layer protocol in Node.js, but I couldn't find anything in the documentation used to interact directly with the IP protocol.我想尝试在 Node.js 中创建传输层协议,但我在用于直接与 IP 协议交互的文档中找不到任何内容。 I tried skimming through the code for the implementation of UDP to no avail.我尝试浏览 UDP 的实现代码,但无济于事。 Can anyone lead me in the right direction?谁能引导我朝着正确的方向前进?

You will need to create a c++/c module for Node, as node does not expose an API for accessing raw sockets.您需要为 Node 创建一个 c++/c 模块,因为 node 不会公开 API 来访问原始 sockets。

There is a npm package that can do this for you.有一个 npm package 可以为您做这件事。 https://www.npmjs.com/package/raw-socket https://www.npmjs.com/package/raw-socket

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM