{-# language DataKinds #-} signature Datagram.Receive where import Socket.Buffer (Buffer) import Data.Primitive.PrimArray.Offset (MutablePrimArrayOffset) import Foreign.C.Error (Errno) import Foreign.C.Types (CSize,CInt) import GHC.Exts (RealWorld) import Posix.Socket (MessageFlags,Message(Receive)) import Posix.Socket (SocketAddress,SocketAddressInternet) import Prelude (Either,IO,Int) import System.Posix.Types (Fd) data AddressBuffer data AddressBufferOffset -- writeAddress :: AddressBuffer -> Int -> Address -> IO () offsetAddress :: AddressBuffer -> Int -> AddressBufferOffset -- Make a single POSIX @recv@ call with the unsafe FFI. This -- is intended to be used on a datagram socket. This is allowed -- to throw an unrecoverable exception if the returned socket -- address is of the wrong length. receiveFromOnce :: Fd -> Buffer -> MessageFlags 'Receive -> AddressBufferOffset -> IO (Either Errno CSize)