udp-conduit: Simple fire-and-forget conduit UDP wrappers

[ conduit, data, library ] [ Propose Tags ]

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

[Skip to Readme]




Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,
Dependencies base (>=4.7 && <5), chunked-data, conduit-combinators, mono-traversable, network [details]
License ISC
Copyright (c) 2016 kqr
Author kqr
Maintainer k@rdw.se
Category Data, Conduit
Home page https://github.com/kqr/udp-conduit#readme
Source repo head: git clone https://github.com/kqr/udp-conduit
Uploaded by kqr at 2016-10-21T07:41:09Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2084 total (9 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-10-21 [all 1 reports]

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!