I can't find a good info on dealing with Unix Domain sockets in Haskell. I need a simple function to open a socket and write a command to it. Can anyone help me with an advice of where to read about this or maybe give an example?
Basically, I need to port this simple Ruby function (if it helps to understand what I mean):
def monitor(string_command)
require "socket"
socket = File.join($vbase, @name, "monitor.soc")
raise RuntimeError, "Monitor socket does not exst!" unless File.exist? socket
begin
UNIXSocket.open(socket) do |s|
s.puts string_command
s.flush
end
rescue
return false
end
true
end
All it does opens socket and writes a command to it returning true upon success. Thank you.