The Socket interface is a ``higher-level'' interface to sockets, and it is what we recommend. Please tell us if the facilities it offers are inadequate to your task! The interface is relatively modest:
data Socket -- instance of: Eq, Show
data PortID =
Service String -- Service Name eg "ftp"
| PortNumber PortNumber -- User defined Port Number
| UnixSocket String -- Unix family socket in file system,
-- not available con Cygwin/Mingw
type Hostname = String
connectTo :: Hostname -> PortID -> IO Handle
listenOn :: PortID -> IO Socket
accept :: Socket -> IO (Handle, HostName)
sendTo :: Hostname -> PortID -> String -> IO ()
recvFrom :: Hostname -> PortID -> IO String
socketPort :: Socket -> IO PortID
withSocketsDo :: IO a -> IO a
data PortNumber -- instance of Eq, Ord, Enum, Num, Real, Integral, Show
mkPortNumber :: Int -> PortNumber |