Giter Club home page Giter Club logo

Comments (10)

alsotang avatar alsotang commented on July 3, 2024

你给这些信息应该不足以让开发者debug吧?

from detect-port.

yibn2008 avatar yibn2008 commented on July 3, 2024

node 版本: v7.7.2

还需要哪些信息?

from detect-port.

alsotang avatar alsotang commented on July 3, 2024

from detect-port.

yibn2008 avatar yibn2008 commented on July 3, 2024

Mac OSX 10.12

from detect-port.

xudafeng avatar xudafeng commented on July 3, 2024

@yibn2008 1024 之前的端口是系统保留端口,执行权限不够,你可以尝试从大一些的端口开始。

from detect-port.

yibn2008 avatar yibn2008 commented on July 3, 2024

@xudafeng 有一个模块可以做到 https://github.com/stdarg/tcp-port-used, 我原来就是用这个模块, 只不过这个模块在 node 7.7 下因为 socket.connect 参数的问题, 导致出错了, 所以想尝试下 detect-port

from detect-port.

yibn2008 avatar yibn2008 commented on July 3, 2024

如果 detect-port 不打算做的话, 我就自己 fork 一个算了

from detect-port.

YounGoat avatar YounGoat commented on July 3, 2024

@yibn2008 准确的说,detect-port 是尝试寻找可用的端口,而不是未被占用的端口。80 端口即使未被占用,非管理员权限通常也不能使用,所以这不是 detect-port 的错。如果 >1024 的端口也存在问题,那就有可能是 bug。方便的话,你可以试一下 portman,告诉我结果。

from detect-port.

yibn2008 avatar yibn2008 commented on July 3, 2024

@YounGoat 哦 ... 快一年多了. 嗯, 我已经开发了一个模块 find-process, 支持检测 80 端口占用.

说到底, 还是机制的问题. 用 listen 去做, 当然会有权限问题了. 有另外一个模块, tcp-port-used 是支持在非 root 权限下检测 80 端口的, 它的原理是用 socket 去连, 不过在 Mac 上会有些 bug, 不一定准确.

目前看来, 通过 netstat 去判断是最为准确的, 这也是 find-process 选择的方式.

from detect-port.

fengmk2 avatar fengmk2 commented on July 3, 2024

小于 1024 的端口都需要 root 权限的,这是基本常识。
如你需要真正探测 80 端口,那么你需要让当前用户变成 root,如加 sudo

sudo detect-port 80

from detect-port.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.