1 ! Copyright (C) 2012 Eungju PARK.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: byte-arrays calendar destructors formatting io kernel
4 math.parser strings threads zeromq zeromq.ffi ;
5 IN: zeromq.examples.taskwork
12 ! Socket to receive messages on
13 ZMQ_PULL <zmq-socket> &dispose
14 dup "tcp://localhost:5557" zmq-connect
16 ! Socket to send messages to
17 ZMQ_PUSH <zmq-socket> &dispose
18 dup "tcp://localhost:5558" zmq-connect
21 ! Process tasks forever
23 over 0 zmq-recv >string
24 ! Simple progress indicator for the viewer
25 dup "%s." printf flush
27 string>number milliseconds sleep
28 ! Send results to sink
29 dup "" >byte-array 0 zmq-send