I tried to send a message from the client to the server and print the message on the server.
server.rkt:
(define the-listener (tcp-listen 9876))
(define-values (in out) (tcp-accept the-listener))
(displayln (read in))
(tcp-close the-listener)
client.rkt:
(define-values (in out) (tcp-connect "localhost" 9876))
(write "Hello" out)
I launched server.rktand then client.rktin the terminal. But the server prints #<eof>instead of a message Hello.
Why? And how to do it right?
source
share