HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleport-utils-0.2.1.0Haskell2010

Network.Socket.Free

  • 2 values
valueopenFreePort :: IO (Int, Socket)
#

Open a TCP socket on a random free port. This is like warp's openFreePort.

Since 0.0.0.1

valuegetFreePort :: IO Int
#

Open a TCP socket, get its port and close the socket. Useful when you have an external service that needs a fresh port.

There is a small race condition present: It's possible to get a free port only for it to be bound by some other process or thread before used

Since 0.2.1