Popularity
4.8
Declining
Activity
0.0
Stable
5
4
2

Monthly Downloads: 11
Programming language: Haskell
License: ISC License
Tags: Data     Conduit    

udp-conduit alternatives and similar packages

Based on the "Conduit" category.
Alternatively, view udp-conduit alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of udp-conduit or a related project?

Add another 'Conduit' Package

README

udp-conduit

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:

{-# LANGUAGE OverloadedStrings #-}
import Conduit
import Conduit.UDP

main :: IO ()
main =
    runConduitRes (yield "hello, world!\n" .| encodeUtf8C .| udpSink "127.0.0.1" 8888)

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

import Conduit
import Conduit.UDP

main :: IO ()
main =
    runConduitRes (udpSourcePlain "127.0.0.1" 5666 500 .| stdoutC)

Now, here's an example where we receive messages on port 8001, encode them as hex digits, and then send them on to port 8002.

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

main :: IO ()
main =
    runConduitRes (udpSourcePlain "127.0.0.1" 8001 500 .| encodeBase16C  .| udpSink "127.0.0.1" 8002)

Fun, huh? And simple!

You can use udpSource to get the ip address of the sender together with the message in a pair (ByteString, SockAddr)