The udp-conduit package

[ Tags: conduit, data, library ] [ Propose Tags ]

udp-conduit provides simple wrappers to get fire-and-forget UDP sinks and sources.

[Skip to Readme]


Dependencies base (>=4.7 && <5), chunked-data, conduit-combinators, mono-traversable, network [details]
License ISC
Copyright (c) 2016 kqr
Author kqr
Category Data, Conduit
Home page
Source repository head: git clone
Uploaded Fri Oct 21 07:41:09 UTC 2016 by kqr
Distributions NixOS:
Downloads 158 total (10 in the last 30 days)
Rating 2.0 (1 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-10-21 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for udp-conduit-

[back to package description]


Simple fire-and-forget style conduit parts (sources/sinks) for UDP traffic.

Here's an example that sends a message to UDP port 8888 on localhost:

import Conduit
import Conduit.UDP
import Data.Text

message :: Text
message = "hello, world!\n"

main :: IO ()
main =
    runConduitRes (yield message .| encodeUtf8C .| udpSink "" 8888)

Here's an example where we continuously receive messages on port 5666 on localhost:

import Conduit
import Conduit.UDP

main :: IO ()
main =
    runConduitRes (udpSource "" 5666 .| decodeUtf8C .| stdoutC)

Now, here's an example where we receive messages on port 8001, transform them to upper-case, and then send them on to port 8002.

import Conduit
import Conduit.UDP
import Data.Char (toUpper)

main :: IO ()
main =
    runConduitRes (udpSource "" 8001 .| omapCE toUpper .| udpSink "" 8002)

Fun, huh? And simple!