-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simple multicast library
--   
--   The <a>Network.Multicast</a> module is for sending UDP datagrams over
--   multicast (class D) addresses.
@package network-multicast
@version 0.2.0


-- | The <a>Network.Multicast</a> module is for sending UDP datagrams over
--   multicast (class D) addresses.
module Network.Multicast

-- | Calling <a>multicastSender</a> creates a client side UDP socket for
--   sending multicast datagrams to the specified host and port.
--   
--   Minimal example:
--   
--   <pre>
--   import Network.Socket
--   import Network.Multicast
--   main = withSocketsDo $ do
--       (sock, addr) &lt;- multicastSender "224.0.0.99" 9999
--       let loop = do
--           sendTo sock "Hello, world" addr
--           loop in loop
--   </pre>
multicastSender :: HostName -> PortNumber -> IO (Socket, SockAddr)

-- | Calling <a>multicastReceiver</a> creates and binds a UDP socket for
--   listening multicast datagrams on the specified host and port.
--   
--   Minimal example:
--   
--   <pre>
--   import Network.Socket
--   import Network.Multicast
--   main = withSocketsDo $ do
--       sock &lt;- multicastReceiver "224.0.0.99" 9999
--       let loop = do
--           (msg, _, addr) &lt;- recvFrom sock 1024
--           print (msg, addr) in loop
--   </pre>
multicastReceiver :: HostName -> PortNumber -> IO Socket

-- | Make the socket listen on multicast datagrams sent by the specified
--   <a>HostName</a>.
addMembership :: Socket -> HostName -> Maybe HostName -> IO ()

-- | Stop the socket from listening on multicast datagrams sent by the
--   specified <a>HostName</a>.
dropMembership :: Socket -> HostName -> Maybe HostName -> IO ()

-- | Enable or disable the loopback mode on a socket created by
--   <a>multicastSender</a>. Loopback is enabled by default; disabling it
--   may improve performance a little bit.
setLoopbackMode :: Socket -> LoopbackMode -> IO ()

-- | Set the Time-to-Live of the multicast.
setTimeToLive :: Socket -> TimeToLive -> IO ()

-- | Set the outgoing interface address of the multicast.
setInterface :: Socket -> HostName -> IO ()
type TimeToLive = Int
type LoopbackMode = Bool
enableLoopback :: LoopbackMode
noLoopback :: LoopbackMode
