Browse files

Fix examples in CL, Closure, Haskell, Objective-C

  • Loading branch information...
1 parent 803902e commit 0746a13b3662935592c9d88b9c46e886d0cfa223 @igorw igorw committed Dec 29, 2011
View
2 examples/CL/identity.lisp
@@ -17,7 +17,7 @@
(defun main ()
(zmq:with-context (context 1)
- (zmq:with-socket (sink context zmq:ROUTER)
+ (zmq:with-socket (sink context zmq:router)
(zmq:bind sink "inproc://example")
;; First allow 0MQ to set the identity
View
4 examples/CL/lruqueue.lisp
@@ -61,8 +61,8 @@
(defun main ()
;; Prepare our context and sockets
(zmq:with-context (context 1)
- (zmq:with-socket (frontend context zmq:ROUTER)
- (zmq:with-socket (backend context zmq:ROUTER)
+ (zmq:with-socket (frontend context zmq:router)
+ (zmq:with-socket (backend context zmq:router)
(zmq:bind frontend "ipc://frontend.ipc")
(zmq:bind backend "ipc://backend.ipc")
View
4 examples/CL/msgqueue.lisp
@@ -16,10 +16,10 @@
(defun main ()
(zmq:with-context (context 1)
;; Socket facing clients
- (zmq:with-socket (frontend context zmq:ROUTER)
+ (zmq:with-socket (frontend context zmq:router)
(zmq:bind frontend "tcp://*:5559")
;; Socket facing services
- (zmq:with-socket (backend context zmq:DEALER)
+ (zmq:with-socket (backend context zmq:dealer)
(zmq:bind backend "tcp://*:5560")
;; Start built-in device
View
4 examples/CL/mtserver.lisp
@@ -33,10 +33,10 @@
;; Prepare our context and socket
(zmq:with-context (context 1)
;; Socket to talk to clients
- (zmq:with-socket (clients context zmq:ROUTER)
+ (zmq:with-socket (clients context zmq:router)
(zmq:bind clients "tcp://*:5555")
;; Socket to talk to workers
- (zmq:with-socket (workers context zmq:DEALER)
+ (zmq:with-socket (workers context zmq:dealer)
(zmq:bind workers "inproc://workers")
;; Launch pool of worker threads
View
4 examples/CL/rrbroker.lisp
@@ -15,8 +15,8 @@
(defun main ()
;; Prepare our context and sockets
(zmq:with-context (context 1)
- (zmq:with-socket (frontend context zmq:ROUTER)
- (zmq:with-socket (backend context zmq:DEALER)
+ (zmq:with-socket (frontend context zmq:router)
+ (zmq:with-socket (backend context zmq:dealer)
(zmq:bind frontend "tcp://*:5559")
(zmq:bind backend "tcp://*:5560")
View
6 examples/CL/rtdealer.lisp
@@ -16,7 +16,7 @@
(in-package :zguide.rtdealer)
(defun worker-a (context)
- (zmq:with-socket (worker context zmq:DEALER)
+ (zmq:with-socket (worker context zmq:dealer)
(zmq:setsockopt worker zmq:identity "A")
(zmq:connect worker "ipc://routing.ipc")
@@ -30,7 +30,7 @@
(incf total))))))
(defun worker-b (context)
- (zmq:with-socket (worker context zmq:DEALER)
+ (zmq:with-socket (worker context zmq:dealer)
(zmq:setsockopt worker zmq:identity "B")
(zmq:connect worker "ipc://routing.ipc")
@@ -45,7 +45,7 @@
(defun main ()
(zmq:with-context (context 1)
- (zmq:with-socket (client context zmq:ROUTER)
+ (zmq:with-socket (client context zmq:router)
(zmq:bind client "ipc://routing.ipc")
(bt:make-thread (lambda () (worker-a context))
View
2 examples/CL/rtmama.lisp
@@ -37,7 +37,7 @@
(defun main ()
(zmq:with-context (context 1)
- (zmq:with-socket (client context zmq:ROUTER)
+ (zmq:with-socket (client context zmq:router)
(zmq:bind client "ipc://routing.ipc")
(dotimes (i *number-workers*)
View
4 examples/CL/rtrouter.lisp
@@ -14,11 +14,11 @@
(defun main ()
(zmq:with-context (context 1)
- (zmq:with-socket (worker context zmq:ROUTER)
+ (zmq:with-socket (worker context zmq:router)
(zmq:setsockopt worker zmq:identity "WORKER")
(zmq:bind worker "ipc://rtrouter.ipc")
- (zmq:with-socket (server context zmq:ROUTER)
+ (zmq:with-socket (server context zmq:router)
(zmq:setsockopt server zmq:identity "SERVER")
(zmq:connect server "ipc://rtrouter.ipc")
View
4 examples/CL/zmsg.lisp
@@ -206,10 +206,10 @@ Discards empty message part after address, if any."
;; Prepare our context and sockets
(zmq:with-context (context 1)
- (zmq:with-socket (output context zmq:DEALER)
+ (zmq:with-socket (output context zmq:dealer)
(zmq:bind output "ipc://zmsg_selftest.ipc")
- (zmq:with-socket (input context zmq:ROUTER)
+ (zmq:with-socket (input context zmq:router)
(zmq:connect input "ipc://zmsg_selftest.ipc")
;; Test send and receive of single-part message
View
2 examples/Clojure/identity.clj
@@ -11,7 +11,7 @@
(defn -main []
(let [ctx (mq/context 1)
- sink (mq/socket ctx mq/ROUTER)
+ sink (mq/socket ctx mq/router)
anonymous (mq/socket ctx mq/req)
identified (mq/socket ctx mq/req)]
(mq/bind sink "inproc://example")
View
4 examples/Clojure/rrbroker.clj
@@ -10,8 +10,8 @@
(defn -main []
(let [ctx (mq/context 1)
- frontend (mq/socket ctx mq/ROUTER)
- backend (mq/socket ctx mq/DEALER)
+ frontend (mq/socket ctx mq/router)
+ backend (mq/socket ctx mq/dealer)
items (.poller ctx 2)]
(mq/bind frontend "tcp://*:5559")
(mq/bind backend "tcp://*:5560")
View
2 examples/Clojure/rtdealer.clj
@@ -28,7 +28,7 @@
(defn -main []
(let [ctx (mq/context 1)
- client (mq/socket ctx mq/ROUTER)
+ client (mq/socket ctx mq/dealer)
srandom (Random. (System/currentTimeMillis))]
(mq/bind client "ipc://routing.ipc")
(-> "A" Worker. Thread. .start)
View
8 examples/Clojure/zhelpers.clj
@@ -19,12 +19,12 @@
(def sndmore ZMQ/SNDMORE)
-(def router ZMQ/ROUTER)
-(def dealer ZMQ/DEALER)
+(def router ZMQ/XREP)
+(def dealer ZMQ/XREQ)
(def req ZMQ/REQ)
(def rep ZMQ/REP)
-(def DEALER ZMQ/DEALER)
-(def ROUTER ZMQ/ROUTER)
+(def xreq ZMQ/XREQ)
+(def xrep ZMQ/XREP)
(def pub ZMQ/PUB)
(def sub ZMQ/SUB)
(def pair ZMQ/PAIR)
View
4 examples/Haskell/msgqueue.hs
@@ -13,8 +13,8 @@ import Data.ByteString.Char8 (pack, unpack)
import Control.Concurrent (threadDelay)
main = withContext 1 $ \context -> do
- withSocket context ROUTER $ \frontend -> do
- withSocket context DEALER $ \backend -> do
+ withSocket context Router $ \frontend -> do
+ withSocket context Dealer $ \backend -> do
bind frontend "tcp://*:5559"
bind backend "tcp://*:5560"
View
4 examples/Haskell/mtserver.hs
@@ -23,11 +23,11 @@ worker context = do
main = withContext 1 $ \context -> do
-- Socket to talk to clients
- withSocket context ROUTER $ \clients -> do
+ withSocket context Router $ \clients -> do
bind clients "tcp://*:5555"
-- Socket to talk to workers
- withSocket context DEALER $ \workers -> do
+ withSocket context Dealer $ \workers -> do
bind workers "inproc://workers"
replicateM_ 5 $ forkIO (worker context)
View
4 examples/Haskell/rrbroker.hs
@@ -5,9 +5,9 @@ import Control.Monad (forever)
main :: IO ()
main = withContext 1 $ \context -> do
- withSocket context ROUTER $ \frontend -> do
+ withSocket context Router $ \frontend -> do
bind frontend "tcp://*:5559"
- withSocket context DEALER $ \backend -> do
+ withSocket context Dealer $ \backend -> do
bind backend "tcp://*5560"
forever $ loop_function frontend backend (-1)
View
4 examples/Objective-C/hwclient.m
@@ -21,9 +21,9 @@
return EXIT_FAILURE;
}
- static const int kMaDEALERuest = 10;
+ static const int kMaxRequest = 10;
NSData *const request = [@"Hello" dataUsingEncoding:NSUTF8StringEncoding];
- for (int request_nbr = 0; request_nbr < kMaDEALERuest; ++request_nbr) {
+ for (int request_nbr = 0; request_nbr < kMaxRequest; ++request_nbr) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
NSLog(@"Sending request %d.", request_nbr);

0 comments on commit 0746a13

Please sign in to comment.