我的操作系统是Windows 10版本10586,node.js是版本4.4.5。
当我使用模块raw-socket时,请按照本页中的示例进行操作 https://github.com/stephenwvickers/node-raw-socket
运行这样的代码时:
var raw = require ("raw-socket");
var socket = raw.createSocket ({protocol: raw.Protocol.None});
我收到了以下错误:
C:\Users\KEEY\node_modules\raw-socket\index.js:47
this.wrap = new raw.SocketWrap (
^
Error: ��һ�ַ���Ȩ�������ķ�ʽ����һ���������ֵij��ԡ�
at Error (native)
at new Socket (C:\Users\KEEY\node_modules\raw-socket\index.js:47:14)
at Object.exports.createSocket (C:\Users\KEEY\node_modules\raw-socket\index.js:202:9)
at Object.<anonymous> (C:\Users\KEEY\Desktop\node\raw-socket\demo.js:2:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
[Finished in 0.2s with exit code 1]
如何解决?
答案 0 :(得分:1)
感谢大家的帮助。 我给模块raw-socket的作者Stephen Vickers发邮件,问题的根源是
Stephen Vickers:
It looks like you don't have permissions to open raw sockets on that platform.
然后我以管理员身份运行它,它的工作原理! 谢谢你,Stephen Vickers
答案 1 :(得分:0)
试试这个
var socket = raw.createSocket ({
protocol: raw.Protocol.None,
socketOption: raw.SocketOption.IPV6_HDRINCL
});