network-bytestring-0.1.1: Fast and memory efficient low-level networkingSource codeContentsIndex
Network.Socket.ByteString
Portabilityportable
Stabilityexperimental
Maintainerjohan.tibell@gmail.com
Contents
Send a message on a socket
Receive a message from a socket
Description

| A module for efficiently transmitting data over sockets. For detailed documentation consult your favorite POSIX socket reference. All functions communicate failures by converting the error number to an System.IO.IOError.

This module is intended to be imported together with Network.Socket like so:

 import Network.Socket hiding (send, sendTo, recv, recvFrom)
 import Network.Socket.ByteString
Synopsis
send :: Socket -> ByteString -> IO Int
sendTo :: Socket -> ByteString -> SockAddr -> IO Int
recv :: Socket -> Int -> IO ByteString
recvFrom :: Socket -> Int -> IO (ByteString, SockAddr)
Send a message on a socket
Functions used to transmit a message to another socket.
sendSource
:: SocketBound/Connected socket.
-> ByteStringData to send.
-> IO IntNumber of bytes sent.
Transmit a message to another socket. The socket must be in a connected state so that the intended recipient is known.
sendToSource
:: Socket(Possibly) bound/connected socket.
-> ByteStringData to send.
-> SockAddrRecipient address.
-> IO IntNumber of bytes sent.
Transmit a message to another socket. The recipient can be specified explicitly so the socket must not (but can be) in a connected state.
Receive a message from a socket
Functions used to receive messages from a socket, and may be used to receive data on a socket whether or not it is connection-oriented.
recvSource
:: SocketBound/connected socket.
-> Int
-> IO ByteString
Receive a message from another socket. The socket must be in a connected state so that the intended recipient is known. Note that the length of the received data can be smaller than specified maximum length. If the message is longer than the specified length it may be discarded depending on the type of socket. May block until a message arrives.
recvFromSource
:: Socket(Possibly) bound/connected socket.
-> IntMaximum number of bytes to receive.
-> IO (ByteString, SockAddr)Data received and sender address.
Similar to recv but can be used to receive data on a socket that is not connection-oriented.
Produced by Haddock version 2.4.2