Folks,

How should I use send-new-place-channel-to-named-dest? The first
argument /ch/ is contracted to be a *channel? and the documentation
says:

> The channel ch should be a connection to a message-router.

I am not sure what a “message-router” is (other than a function that
loops over its event containers). I am less confident yet what a
“connection to a message-router” is.

I want to set up a side-channel to the remote place. I want this to be
a place-channel with respect to the "hello-world" place. This is a
de-commented version of the example in the documentation, along with my
failed attempt at adding a side-channel.

Eventually I’d like to broadcast to this place -- but that’s for a later
day.

Thanks,

Tim

;; ---------------------------------------------------------------------
#lang racket/base
(require racket/place/distributed
         racket/place
         racket/class)

(provide hello-world)

(define (hello-world)
  (place ch
         (define id (place-channel-get ch))
         (printf/f "hello-world “~a” up and running~%" id)
         (define chnl (place-channel-get ch))
         (printf/f "hello-world got chnl: ~s~%" chnl)
         (printf "hello-world received: ~a\n" (place-channel-get ch))
         (place-channel-put ch "Hello World\n")
         (printf "hello-world sent: Hello World\n")))

(module+ main
  ;; create node and pl separately so I can #:named the place
  (define node (create-place-node "localhost" #:listen-port 6344))
  ;; [!] this prints out (to stdout) "(6344)"

  (define pl (supervise-place-at
              node
              #:thunk #t
              #:named 'bubbles
              (quote-module-path "..")
              'hello-world))

  (define rem-con (new remote-connection% [node node] [name "foo"]))

  (message-router
   node
   rem-con ; is *this* a “connection to a message-router”?
   (after-seconds
    2
    (*channel-put pl "bubbles")
    (printf/f "rem-con is a channel? ~a~%" (*channel? rem-con))
    (send-new-place-channel-to-named-dest
     rem-con
     'bubbles-side
     (list "localhost" 6344 "bubbles"))
    (*channel-put pl "Hello")
    (printf "message-router received: ~a\n" (*channel-get pl)))

   (after-seconds 6 (exit 0))))
;; ---------------------------------------------------------------------


-- 
Tim Brown CEng MBCS <tim.br...@cityc.co.uk>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                City Computing Limited · www.cityc.co.uk
      City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
                T:+44 20 8770 2110 · F:+44 20 8770 2130
────────────────────────────────────────────────────────────────────────
City Computing Limited registered in London No:1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT No: GB 918 4680 96

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to