On 6/30/05, Joe Van Dyk <> wrote:
> require 'socket'
>=20
> tcp_server =3D TCPServer.new 'localhost', 4321
>=20
> puts "connecting..."
> tcp_client =3D TCPSocket.new 'localhost', 4321
> tcp_client.write "Hello World"
> puts "finshed writing"
>=20
> session =3D tcp_server.accept
> puts "we recieved: <#{session.gets}>"
>=20
>=20
>=20
> Why doesn't that work?
Or, a threaded version:
require 'socket'
t =3D Thread.new do=20
tcp_server =3D TCPServer.new 'localhost', 4321
while (session =3D tcp_server.accept)
puts "we recieved: <#{session.gets}>"
end
end
tcp_client =3D TCPSocket.new 'localhost', 4321
tcp_client.write "Hello World"
t.join
Still doesn't work though.

What am I missing?