Open
Description
To reproduce:
{-# LANGUAGE OverloadedStrings #-}
import Control.Exception
import Network.Socket
import Data.Streaming.Network
main :: IO ()
main = do
_ <- bindPortTCP 3000 "*"
try @SomeException (bindPortTCP 3000 "*") >>= print
try @SomeException (bindPortAny 3000) >>= print
bindPortAny :: PortNumber -> IO Socket
bindPortAny port = do
sock <- socket AF_INET Stream defaultProtocol
setSocketOption sock ReuseAddr 1
bind sock (SockAddrInet port anyInterface)
listen sock maxListenQueue
return sock
anyInterface :: HostAddress
anyInterface = tupleToHostAddress (0, 0, 0, 0)
$ cabal install --lib --package-env=. base-4.20.0.0 network-3.2.1.0 streaming-commons-0.2.2.6
$ runhaskell streaming-commons-bug.hs
Actual:
Left Network.Socket.socket: unsupported operation (Address family not supported by protocol)
Left Network.Socket.bind: resource busy (Address already in use)
Expected:
Left Network.Socket.bind: resource busy (Address already in use)
Left Network.Socket.bind: resource busy (Address already in use)
Metadata
Assignees
Labels
No labels
Activity