Networking and HTTP

The libraries in this subsection are as follows:

  • network (module Network) and network-uri: Low-level networking on bare sockets
  • connection: Easy-to-use abstraction on TCP connections. Supports TLS and HTTP or SOCKS proxies out of the box.

Basic low-level networking using the network package has been discussed in Chapter 6, I/O and Streaming.

For a bit higher-level TCP client communication, the connection package provides a nice little abstraction layer. Plus, connection supports SSL/TLS and SOCKS with minimal configuration. A connection is established primarily by defining a configuration value of type ConnectionParams, given by:

data ConnectionParams = ConnectionParams { connectionHostname :: HostName , connectionPort :: PortNumber ...

Get Haskell High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.