Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit 561f926

Browse files
committed
Added zeromq.zmq/send-all function
1 parent b92419f commit 561f926

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/zeromq/zmq.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@
218218
(recur new-acc)
219219
(persistent! new-acc)))))
220220

221+
(defn send-all
222+
"Send all data parts to the socket.
223+
coll is a seq containing byte arrays."
224+
[^ZMQ$Socket socket coll]
225+
(loop [i 0]
226+
(let [frame (nth coll i)
227+
flags (if (= i (- (count coll) 1))
228+
0
229+
send-more)]
230+
(send socket frame flags)
231+
(when (< (+ i 1) (count coll)) (recur (+ i 1))))))
232+
221233
(defn ^ZMQ$Socket set-linger
222234
"The linger option shall set the linger period for the specified socket. The
223235
linger period determines how long pending messages which have yet to be sent

0 commit comments

Comments
 (0)