Overview
Comment: | Cleaned up the example nng app |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.6584-nanomsg |
Files: | files | file ages | folders |
SHA1: |
056cbbf3bcd750b190675a6e0f28a793 |
User & Date: | matt on 2021-10-27 05:22:20 |
Other Links: | branch diff | manifest | tags |
Context
2021-11-15
| ||
15:05 | Merged fork check-in: 18439ca550 user: matt tags: v1.6584-nanomsg | |
2021-10-27
| ||
05:22 | Cleaned up the example nng app check-in: 056cbbf3bc user: matt tags: v1.6584-nanomsg | |
2021-10-21
| ||
16:19 | Got crude nng transport implementation working/ check-in: 96b5fc4451 user: matt tags: v1.6584-nanomsg | |
Changes
Modified nng-trial/Makefile from [c83d590f9e] to [c9bb6fcc89].
1 2 3 4 5 | nng-test : nng-test.scm csc nng-test.scm test : nng-test ./nng-test do-test | > > > | 1 2 3 4 5 6 7 8 | nng-test : nng-test.scm csc nng-test.scm test : nng-test ./nng-test do-test clean : rm -f .runners/* NBFAKE* |
Modified nng-trial/nng-test.scm from [1f5de0e9fe] to [a81f0cc6e1].
|
| > > > | > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | (module nng-test * (import scheme (chicken io) (chicken base) (chicken time) (chicken file) (chicken file posix) (chicken string) (chicken process-context) (chicken process-context posix) miscmacros nng srfi-18 srfi-69 test matchable typed-records system-information directory-utils ) (define help "Usage: nng-test COMMAND where COMMAND is one of: do-test : run the basic req/rep test run tcp://host:port : start test server - start several in same dir ") (define address-tcp-1 "tcp://localhost:5555") (define address-tcp-2 "tcp://localhost:6666") (define address-inproc-1 "inproc://local1") (define address-inproc-2 "inproc://local2") |
︙ | ︙ | |||
57 58 59 60 61 62 63 | "message" (req-rep-test address-tcp-1)) (test "inproc req-rep" "message" (req-rep-test address-inproc-1))) (test-exit)) | < < < < < < < < < < < | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | "message" (req-rep-test address-tcp-1)) (test "inproc req-rep" "message" (req-rep-test address-inproc-1))) (test-exit)) ;; this should be run in a thread (define (run-listener-responder socket myaddr) (let loop ((status 'running)) (let* ((msg (nng-recv socket)) (response (process-message msg))) (if (not (eq? response 'done)) (begin |
︙ | ︙ | |||
108 109 110 111 112 113 114 | 'done (conc msg " " (if count count 0))))) ((msg) (conc msg " 0")) (else "hello 0")))) | | < < | | | | | | | | | | > | | | | < < > | | | | | | | | | > > > > > | | | | | | | | | | > > > > > > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | 'done (conc msg " " (if count count 0))))) ((msg) (conc msg " 0")) (else "hello 0")))) (define (main) (match (command-line-arguments) (("do-test")(do-test)) ((run myaddr) ;; start listener ;; put myaddr into file by host-pid in .runners ;; for 1 minute ;; get all in .runners ;; call each with a message ;; (let* ((endtimes (+ (current-seconds) 20)) ;; run for 20 seconds (socket (make-listening-reply-socket myaddr)) (rfile (conc ".runners/"(get-host-name)"-"(current-process-id))) (th1 (make-thread (lambda () (run-listener-responder socket myaddr) ) "responder"))) (if (not (and (file-exists? ".runners") (directory? ".runners"))) (create-directory ".runners" #t)) (with-output-to-file rfile (lambda () (print myaddr))) (thread-start! th1) (let loop ((entries '())) (if (> (current-seconds) endtimes) (begin (delete-file* rfile) (sleep 1) (exit)) (if (null? entries) (loop (glob ".runners/*")) (let* ((entry (car entries)) (destaddr (with-input-from-file entry read-line))) (call *channels* (conc "hello-from-"destaddr) destaddr) ;; (thread-sleep! 0.025) (loop (cdr entries)))))))) ((cmd)(print "ERROR: command "cmd", not recognised.\n\n"help)) (else (print help)))) ) ;; end module (import nng-test) (main) |