listenOn specific IP

I'm trying to write a simple server with network. listenOnSource takes a socket number, but tries to bind to every available IP, which isn't what I need. How do I tell it to bind to a specific address?

vold
I'm trying to write a simple server with network. listenOn takes a socket number, but tries to bind to every available IP, which isn't what I need. How do I tell it to bind to a specific address?
I did this eventually by writing my own copy of the listenOn function listenOn' host (PortNumber port) = do proto <- getProtocolNumber "tcp" bracketOnError (socket AF_INET Stream proto) (sClose) (\sock -> do setSocketOption sock ReuseAddr 1 bindSocket sock (SockAddrInet port host) listen sock maxListenQueue return sock ) It feels very hacky though.
participants (1)
-
vold