2020-04-27 18:27:48 +00:00
|
|
|
#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))
|
2020-04-27 19:21:40 +00:00
|
|
|
(issue-credit! tcp-in id)
|
2020-04-27 18:27:48 +00:00
|
|
|
(send! (tcp-out id (bytes-append bs (bytes 13 10)))))))
|