16 lines
369 B
Haskell
16 lines
369 B
Haskell
module Client.Communication where
|
|
|
|
import Network.Socket
|
|
|
|
import System.IO
|
|
|
|
connectSocket
|
|
:: FilePath
|
|
-> IO Handle
|
|
connectSocket path = do
|
|
sock <- socket AF_UNIX Stream defaultProtocol
|
|
setSocketOption sock KeepAlive 1
|
|
connect sock (SockAddrUnix path)
|
|
handle <- socketToHandle sock ReadWriteMode
|
|
hSetBuffering handle (BlockBuffering Nothing)
|
|
pure handle
|