Created
August 21, 2010 10:05
-
-
Save johnbender/542102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- rcv.hs | |
import System.ZMQ as ZMQ | |
import Control.Monad | |
main = do context <- ZMQ.init 1 | |
sock <- socket context Sub | |
subscribe sock "" | |
connect sock "tcp://localhost:5555" | |
forever $ do | |
str <- receive sock [] | |
print str | |
-- snd.hs | |
import System.ZMQ as ZMQ | |
import Control.Monad | |
import Data.ByteString.Lazy hiding (map) | |
import Data.ByteString.Internal | |
main = do context <- ZMQ.init 1 | |
sock <- socket context Pub | |
bind sock "tcp://127.0.0.1:5555" | |
-- 99% sure there's a better way to do this | |
forever $ send' sock (pack $ map c2w "Foo") [] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment