forked from orbit-oss/flask
Fix the command for checking port on macOS in server docs
This commit is contained in:
parent
6389c07530
commit
0122a4f34f
1 changed files with 13 additions and 6 deletions
|
|
@ -80,27 +80,34 @@ messages:
|
||||||
Either identify and stop the other program, or use
|
Either identify and stop the other program, or use
|
||||||
``flask run --port 5001`` to pick a different port.
|
``flask run --port 5001`` to pick a different port.
|
||||||
|
|
||||||
You can use ``netstat`` to identify what process id is using a port,
|
You can use ``netstat`` or ``lsof`` to identify what process id is using
|
||||||
then use other operating system tools stop that process. The following
|
a port, then use other operating system tools stop that process. The
|
||||||
example shows that process id 6847 is using port 5000.
|
following example shows that process id 6847 is using port 5000.
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
.. group-tab:: Linux/Mac
|
.. tab:: ``netstat`` (Linux)
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
|
|
||||||
$ netstat -nlp | grep 5000
|
$ netstat -nlp | grep 5000
|
||||||
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 6847/python
|
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 6847/python
|
||||||
|
|
||||||
.. group-tab:: Windows
|
.. tab:: ``lsof`` (macOS / Linux)
|
||||||
|
|
||||||
|
.. code-block:: text
|
||||||
|
|
||||||
|
$ lsof -P -i :5000
|
||||||
|
Python 6847 IPv4 TCP localhost:5000 (LISTEN)
|
||||||
|
|
||||||
|
.. tab:: ``netstat`` (Windows)
|
||||||
|
|
||||||
.. code-block:: text
|
.. code-block:: text
|
||||||
|
|
||||||
> netstat -ano | findstr 5000
|
> netstat -ano | findstr 5000
|
||||||
TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 6847
|
TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 6847
|
||||||
|
|
||||||
MacOS Monterey and later automatically starts a service that uses port
|
macOS Monterey and later automatically starts a service that uses port
|
||||||
5000. To disable the service, go to System Preferences, Sharing, and
|
5000. To disable the service, go to System Preferences, Sharing, and
|
||||||
disable "AirPlay Receiver".
|
disable "AirPlay Receiver".
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue