无法使用net.connect连接到套接字

时间:2019-12-03 07:03:51

标签: node.js sockets

不知道我在做什么错

const net = require('net')
const local = net.connect('./a',()=>console.log("connected!"))
  • ./a不存在。即使我使用tempy模块生成随机路径,也遇到相同的问题

错误:

events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: connect ENOENT ./a
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1134:14)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'connect',
  address: './a'
}

0 个答案:

没有答案