It's handy to send server response to the client by
server = TCPServer.open 1234
socket = server.accept
socket.puts 'data from server side'
and in the client side, curl in this case
curl -v localhost:1234
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 1234 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:1234
> Accept: */*
>
data from server side
at this point, it seems I can still input something in the curl, so I assume the tcp connection is bidirectional, I input
data from the curl client
after that, how can I receive this message from curl client in the current TCPSocket instance?
I've tried
socket.read
but it doesn't work