Keith Wansbrough
Thu, 09 Aug 2001 16:01:06 +0100

Koen writes:

>   accept :: Socket -> IO (Handle, HostName, PortNumber)
> Unfortunately, this is a blocking function, which means that
> the whole program blocks when it is waiting for a
> connection.
> Ideally, I would like to integrate this with the function
> "hSelect" from the Select module.

man 2 accept on my Linux says:

       In  order  to  be  notified  of  incoming connections on a
       socket, you can use  select(2)  or  poll(2).   A  readable
       event will be delivered when a new connection is attempted
       and you may then call accept to get a socket for that con-

So I imagine if you passed the socket as the first arg to Select.hSelect, you'd get what you want.  SocketPrim.socketToHandle claims to do the required conversion.

disclaimer: I haven't tried this.

--KW 8-)

Keith Wansbrough <>
Cambridge University Computer Laboratory.