[squeak-dev] Re: Webclient + localhost error
Sean P. DeNigris
sean at clipperadams.com
Fri Oct 29 19:04:47 UTC 2010
Duh, I kept thinking that and forgot...
I tried a few different examples:
1. Starting with the one from the pickaxe book:
server = TCPServer.new('localhost', 8091)
while (session = server.accept)
puts "Request: #{session.gets}"
session.print "HTTP/1.1 200/OK\r\nContent-type: text/html\r\n\r\n"
session.print "<html><body><h1>#{Time.now}</h1></body></html>\r\n"
session.close
end
2. server = TCPServer.open(2002) # Socket to listen on port 2000
loop { # Servers run forever
client = server.accept # Wait for a client to connect
client.puts(Time.now.ctime) # Send the time to the client
client.puts "Closing the connection. Bye!"
client.close # Disconnect from the client
}
3. server = TCPServer.new('localhost', 8091)
while (true)
begin
sock = server.accept_nonblock
rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
IO.select([server])
retry
end
sock.print "sdflkdsjfslkdj"
sock.close
end
All three work in Safari and fail in WebClient.
Thanks.
Sean
--
View this message in context: http://forum.world.st/Webclient-localhost-error-tp3018443p3019623.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|