Paste: zmq hello-world-server example

Author: Arrogant
Mode: factor
Date: Wed, 20 Oct 2010 08:37:43
Plain Text |
USING:
    kernel io io.encodings.utf8 destructors byte-arrays calendar threads
    zmq zmq.ffi
    alien.data
    threads
    ;
IN: zmq.examples.hello-world-server

: hello-world-server ( -- )
    1 <context>
    [
        ZMQ_REP <socket>
        dup "tcp://*:5555" bind-socket
        [
            [ t ] [
                dup utf8 recv-string print yield
                1 seconds sleep
                [ "World" utf8 send-string ] keep
            ] while
        ] with-disposal drop
    ] with-disposal
    ;

MAIN: hello-world-server

New Annotation

Summary:
Author:
Mode:
Body: