(define hostname "localhost")
(define echo-port 23421)

(define (echo inport outport)
  (let ((v (read-line)))
    (when (not (eof-object? v))
      (display v outport)
      (display #\newline outport)
      (display (read-line inport)) (newline)
      (echo inport outport))))

(call-with-values
 (lambda () (tcp-connect hostname echo-port))
 echo)