-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Description
@Misuke socketPair call error since Windows does not provide socketpair(2).
The following code could emulate socketPair on Windows when we support AF_UNIX.
What do you think?
sockpair :: IO (Socket, Socket)
sockpair = withSystemTempFile "temp-for-pair" $ \file hdl -> do
hClose hdl
removeFile file
listenSock <- socket AF_UNIX Stream defaultProtocol
bind listenSock $ SockAddrUnix file
listen listenSock 10
clientSock <- socket AF_UNIX Stream defaultProtocol
connect clientSock $ SockAddrUnix file
(serverSock, _) <- accept listenSock
close listenSock
return (clientSock, serverSock)Metadata
Metadata
Assignees
Labels
No labels