Network.Transport - ku-fpg/blackboard GitHub Wiki

Design

(from http://hackage.haskell.org/package/network-transport)

This design was heavily influenced by the design of the Common Communication Interface (http://www.olcf.ornl.gov/center-projects/common-communication-interface). Important design goals are:

  • Connections should be lightweight: it should be no problem to create thousands of connections between endpoints.
  • Error handling is explicit: every function declares as part of its type which errors it can return (no exceptions are thrown)
  • Error handling is abstract: errors that originate from implementation specific problems (such as no more sockets in the TCP implementation) get mapped to generic errors (insufficient resources) at the Transport level.

This package provides the generic interface only; you will probably also want to install at least one transport implementation (network-transport-*).

Implementation

To start

  • initTransport :: (...) -> IO Transport

Transport

To create a network abstraction layer, use one of the Network.Transport.* packages.

  • newEndPoint :: (...) -> IO EndPoint

EndPoint

Network endpoint.

  • receive :: IO Event
  • address :: EndPointAddress
  • connect :: EndPointAddress -> (...) -> IO Connection

Connection

Lightweight connection to an endpoint.

  • send :: [ByteString] -> IO ()

Event

(Constructors)

  • Received ConnectionId [ByteString]

ConnectionId

An Int64