Git Product home page Git Product logo

Comments (5)

jd avatar jd commented on May 28, 2024

Agreed, it's actually on my TODO list. It's pretty hard to "find a random available port" because there's a big race between the time you find the free port and the time the program binds it.

It seems the best way would be to be able to provide a port range to pifpaf that you are sure are available, no matters what.

from pifpaf.

kryskool avatar kryskool commented on May 28, 2024

I prefer to bind a loopback interface 127.0.0.0/8 (according to the RFC 1700) and always keep the same port. It works on Linux, Windows (loopback adapter) and MacOS

On MacOS you must declare the new loopback interface manually like
sudo ifconfig lo666 alias 127.6.6.6
and to remove it
sudo ifconfig lo666 -alias 127.6.6.6

I use this tips to launch multiple versions of PostgreSQL server with loopback that containt the version number in the loopback address and port 5432 like:

  • 127.0.9.3 for PostgreSQL 9.3
  • 127.0.9.4 for PostgreSQL 9.4
  • 127.0.9.5 for PostgreSQL 9.5

from pifpaf.

jd avatar jd commented on May 28, 2024

@kryskool This is a good idea, but it's gonna be tricky if it's not portable out of the box on Darwin :(

from pifpaf.

graingert avatar graingert commented on May 28, 2024

can you not listen on port 0? then ask the program what port it found?

from pifpaf.

graingert avatar graingert commented on May 28, 2024

@jd it might be good to use https://github.com/Yelp/ephemeral-port-reserve/

from pifpaf.

Related Issues (20)

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.