Skip to content

Commit

Permalink
Fix examples in CL, Closure, Haskell, Objective-C
Browse files Browse the repository at this point in the history
  • Loading branch information
igorw committed Dec 29, 2011
1 parent 803902e commit 0746a13
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/CL/identity.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/CL/lruqueue.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions examples/CL/msgqueue.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/CL/mtserver.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/CL/rrbroker.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions examples/CL/rtdealer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")

Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion examples/CL/rtmama.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
4 changes: 2 additions & 2 deletions examples/CL/rtrouter.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions examples/CL/zmsg.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/Clojure/identity.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions examples/Clojure/rrbroker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/Clojure/rtdealer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions examples/Clojure/zhelpers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/Haskell/msgqueue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/Haskell/mtserver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/Haskell/rrbroker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions examples/Objective-C/hwclient.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0746a13

Please sign in to comment.