HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleconduit-extra-1.3.8Haskell2010

Data.Conduit.Network

  • 4 types
  • 22 values

Basic utilities

2 declarations

Simple TCP server/client interface.

5 declarations
datadata AppData
#

The data passed to an Application.

Instances1HasReadWrite

Server

valuerunTCPServer :: ServerSettings -> (AppData -> IO ()) -> IO a
#

Run an Application with the given settings. This function will create a new listening socket, accept connections on it, and spawn a new thread for each connection.

Fork a TCP Server

Will fork the runGeneralTCPServer function but will only return from this call when the server is bound to the port and accepting incoming connections. Will return the thread id of the server

Since 1.1.4

valuerunGeneralTCPServer
  1. :: MonadUnliftIO m
  2. => ServerSettings
  3. -> AppData -> m ()
  4. -> m a
#

Run a general TCP server

Same as runTCPServer, except monad can be any instance of MonadUnliftIO.

Note that any changes to the monadic state performed by individual client handlers will be discarded. If you have mutable state you want to share among multiple handlers, you need to use some kind of mutable variables.

Since 1.1.3

Client

Getters

Setters

Types

1 declaration
datadata HostPreference
#

Which host to bind.

Note: The IsString instance recognizes the following special values:

  • * means HostAny - "any IPv4 or IPv6 hostname"

  • *4 means HostIPv4 - "any IPv4 or IPv6 hostname, IPv4 preferred"

  • !4 means HostIPv4Only - "any IPv4 hostname"

  • *6 means HostIPv6@ - "any IPv4 or IPv6 hostname, IPv6 preferred"

  • !6 means HostIPv6Only - "any IPv6 hostname"

Note that the permissive * values allow binding to an IPv4 or an IPv6 hostname, which means you might be able to successfully bind to a port more times than you expect (eg once on the IPv4 localhost 127.0.0.1 and again on the IPv6 localhost 0:0:0:0:0:0:0:1).

Any other value is treated as a hostname. As an example, to bind to the IPv4 local host only, use "127.0.0.1".

Instances5Eq, Ord, Read, Show, IsString