Racket implementation of Dataspaces and Syndicate.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
525 B

#lang syndicate
(require/activate syndicate/drivers/tcp)
(spawn (during/spawn (tcp-connection $id (tcp-listener 5999))
(on-start (printf "Accepted connection ~v\n" id))
(on-stop (printf "Closed connection ~v\n" id))
(assert (tcp-accepted id))
(on-start (issue-credit! (tcp-listener 5999))
(issue-credit! tcp-in id))
(on (message (tcp-in-line id $bs))
(issue-credit! tcp-in id)
(send! (tcp-out id (bytes-append bs (bytes 13 10)))))))