| Safe Haskell | None |
|---|
Network.Transport
Contents
Description
Network Transport
- data Transport = Transport {}
- data EndPoint = EndPoint {
- receive :: IO Event
- address :: EndPointAddress
- connect :: EndPointAddress -> Reliability -> ConnectHints -> IO (Either (TransportError ConnectErrorCode) Connection)
- newMulticastGroup :: IO (Either (TransportError NewMulticastGroupErrorCode) MulticastGroup)
- resolveMulticastGroup :: MulticastAddress -> IO (Either (TransportError ResolveMulticastGroupErrorCode) MulticastGroup)
- closeEndPoint :: IO ()
- data Connection = Connection {
- send :: [ByteString] -> IO (Either (TransportError SendErrorCode) ())
- close :: IO ()
- data Event
- type ConnectionId = Int
- data Reliability
- data MulticastGroup = MulticastGroup {}
- newtype EndPointAddress = EndPointAddress {}
- newtype MulticastAddress = MulticastAddress {}
- data ConnectHints = ConnectHints {}
- defaultConnectHints :: ConnectHints
- data TransportError error = TransportError error String
- data NewEndPointErrorCode
- data ConnectErrorCode
- data NewMulticastGroupErrorCode
- data ResolveMulticastGroupErrorCode
- data SendErrorCode
- = SendClosed
- | SendFailed
- data EventErrorCode
Types
To create a network abstraction layer, use one of the
Network.Transport.* packages.
Constructors
| Transport | |
Fields
| |
Network endpoint.
Constructors
| EndPoint | |
Fields
| |
data Connection Source
Lightweight connection to an endpoint.
Constructors
| Connection | |
Fields
| |
Event on an endpoint.
Constructors
| Received ConnectionId [ByteString] | Received a message |
| ConnectionClosed ConnectionId | Connection closed |
| ConnectionOpened ConnectionId Reliability EndPointAddress | Connection opened |
| ReceivedMulticast MulticastAddress [ByteString] | Received multicast |
| EndPointClosed | The endpoint got closed (manually, by a call to closeEndPoint or closeTransport) |
| ErrorEvent (TransportError EventErrorCode) | An error occurred |
type ConnectionId = IntSource
Connection data ConnectHintsIDs enable receivers to distinguish one connection from another.
data Reliability Source
Reliability guarantees of a connection.
Constructors
| ReliableOrdered | |
| ReliableUnordered | |
| Unreliable |
Instances
data MulticastGroup Source
Multicast group.
Constructors
| MulticastGroup | |
Fields
| |
newtype MulticastAddress Source
EndPointAddress of a multicast group.
Constructors
| MulticastAddress | |
Fields | |
Hints
defaultConnectHints :: ConnectHintsSource
Default hints for connecting
Error codes
data TransportError error Source
Errors returned by Network.Transport API functions consist of an error code and a human readable description of the problem
Constructors
| TransportError error String |
Instances
| Typeable1 TransportError | |
| Eq error => Eq (TransportError error) | When comparing errors we ignore the human-readable strings |
| Show error => Show (TransportError error) | |
| (Typeable err, Show err) => Exception (TransportError err) | Although the functions in the transport API never throw TransportErrors (but return them explicitly), application code may want to turn these into exceptions. |
data NewEndPointErrorCode Source
Errors during the creation of an endpoint
Constructors
| NewEndPointInsufficientResources | Not enough resources |
| NewEndPointFailed | Failed for some other reason |
data ConnectErrorCode Source
Connection failure
Constructors
| ConnectNotFound | Could not resolve the address |
| ConnectInsufficientResources | Insufficient resources (for instance, no more sockets available) |
| ConnectTimeout | Timeout |
| ConnectFailed | Failed for other reasons (including syntax error) |
data NewMulticastGroupErrorCode Source
Failure during the creation of a new multicast group
Constructors
| NewMulticastGroupInsufficientResources | Insufficient resources |
| NewMulticastGroupFailed | Failed for some other reason |
| NewMulticastGroupUnsupported | Not all transport implementations support multicast |
data ResolveMulticastGroupErrorCode Source
Failure during the resolution of a multicast group
Constructors
| ResolveMulticastGroupNotFound | Multicast group not found |
| ResolveMulticastGroupFailed | Failed for some other reason (including syntax error) |
| ResolveMulticastGroupUnsupported | Not all transport implementations support multicast |
data SendErrorCode Source
Failure during sending a message
Constructors
| SendClosed | Connection was closed |
| SendFailed | Send failed for some other reason |
Instances
data EventErrorCode Source
Error codes used when reporting errors to endpoints (through receive)
Constructors
| EventEndPointFailed | Failure of the entire endpoint |
| EventTransportFailed | Transport-wide fatal error |
| EventConnectionLost (Maybe EndPointAddress) [ConnectionId] | Some incoming connections were closed abruptly. If an endpoint address is specified, then all connections to and from that endpoint are now lost |
Instances