2017-08-10 19:17:28 +00:00
|
|
|
#lang syndicate
|
2016-01-13 16:26:01 +00:00
|
|
|
|
2016-07-30 17:02:07 +00:00
|
|
|
(require syndicate/protocol/advertise)
|
2016-07-12 19:05:56 +00:00
|
|
|
(require/activate syndicate/drivers/tcp)
|
2016-01-13 16:26:01 +00:00
|
|
|
|
2016-02-05 23:03:40 +00:00
|
|
|
(define server-id (tcp-listener 5999))
|
2017-02-15 23:18:19 +00:00
|
|
|
(spawn (assert (advertise (observe (tcp-channel _ server-id _))))
|
|
|
|
(during/spawn (advertise (tcp-channel $c server-id _))
|
2016-08-24 16:35:38 +00:00
|
|
|
(on-start (printf "Accepted connection from ~v\n" c))
|
|
|
|
(assert (advertise (tcp-channel server-id c _)))
|
|
|
|
(on (message (tcp-channel c server-id $bs))
|
|
|
|
(send! (tcp-channel server-id c bs)))
|
|
|
|
(on-stop (printf "Closed connection ~v\n" c))))
|