20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
(nn-send soc "Ok, quitting"))
((and (>= (string-length msg-in) 4)
(equal? (substring msg-in 0 4) "ping"))
(nn-send soc (conc (current-process-id)))
(loop (nn-recv soc)))
;;((and (>= (string-length msg-in)
(else
(let ((this-task (random 15)))
(thread-sleep! this-task)
(nn-send soc (conc "hello " msg-in " this task took " this-task " seconds to complete"))
(loop (nn-recv soc)))))))
(define (ping-self host port #!key (return-socket #t))
;; send a random number along with pid and check that we get it back
(let* ((req (nn-socket 'req))
(key "ping")
|
|
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
(nn-send soc "Ok, quitting"))
((and (>= (string-length msg-in) 4)
(equal? (substring msg-in 0 4) "ping"))
(nn-send soc (conc (current-process-id)))
(loop (nn-recv soc)))
;;((and (>= (string-length msg-in)
(else
(let ((this-task (random 10)))
(thread-sleep! (/ this-task 10.0))
(nn-send soc (conc "hello " msg-in " this task took " this-task " seconds to complete"))
(loop (nn-recv soc)))))))
(define (ping-self host port #!key (return-socket #t))
;; send a random number along with pid and check that we get it back
(let* ((req (nn-socket 'req))
(key "ping")
|