HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleconduit-extra-1.3.8Haskell2010

Data.Conduit.Network.UDP

Contents
  1. UDP message representation
  2. Basic utilities
  3. Helper Utilities
Synopsis

UDP message representation

Basic utilities

valuesourceSocket :: MonadIO m => Socket -> Int -> ConduitT i Message m ()

Stream messages from the socket.

The given len defines the maximum packet size. Every produced item contains the message payload and the origin address.

This function does not automatically close the socket.

valuesinkToSocket :: MonadIO m => Socket -> ConduitT Message o m ()

Stream messages to the socket.

Every handled item contains the message payload and the destination address. The payload is sent using sendTo, so some of it might be lost.

This function does not automatically close the socket.

Stream messages to the socket.

Every handled item contains the message payload and the destination address. The payload is sent using sendAllTo, so it might end up in multiple packets.

This function does not automatically close the socket.

Helper Utilities

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