;;; SPDX-License-Identifier: LGPL-3.0-or-later ;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones #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)))))))