[MacBook-Pro-10:~] clr% vi test.rb
[MacBook-Pro-10:~] clr% ruby test.rb
open http://192.168.0.12:5678/
^CTraceback (most recent call last):
        1: from test.rb:11:in `<main>'
test.rb:11:in `accept': Interrupt


In the browser that popped up: at url http://192.168.0.12:5678
Hello world! The time is 2020-05-15 21:13:44 -0700
Then nothing so I killed the ruby script.

Craig

> On May 15, 2020, at 7:30 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> 
> On Fri, May 15, 2020 at 10:23 PM Craig Russell <apache....@gmail.com> wrote:
>> 
>> Sorry, what do I do with the lines between --------------
>> 
>> Is this a shell script? I run csh...
> 
> It is a Ruby script.  Put it in a file, say test.rb.  Then run 'ruby test.rb'.
> 
>> Craig
> 
> - Sam Ruby
> 
>>> On May 15, 2020, at 6:38 PM, Sam Ruby <ru...@intertwingly.net> wrote:
>>> 
>>> On Fri, May 15, 2020 at 8:10 PM Craig Russell <apache....@gmail.com 
>>> <mailto:apache....@gmail.com>> wrote:
>>>> 
>>>> Hi Sam,
>>>> 
>>>> That helped. I had not installed cctools via brew but I made a backup copy 
>>>> of the/opt/local/bin/ar and ranlib tools so I got farther along with 
>>>> installing ruby 2.4.1.
>>>> 
>>>> [MacBook-Pro-10:whimsy/www/roster] clr% rbenv global
>>>> 2.4.1
>>>> [MacBook-Pro-10:whimsy/www/roster] clr% which ruby
>>>> /usr/local/opt/ruby/bin/ruby
>>>> [MacBook-Pro-10:whimsy/www/roster] clr% ruby -v
>>>> ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
>>>> 
>>>> I hope you are aware that
>>>> WARNING: ruby-2.4.1 is past its end of life and is now unsupported.
>>>> It no longer receives bug fixes or critical security updates.
>>>> 
>>>> Are we planning on migrating to ruby 2.7.x or are we stuck on 2.4?
>>> 
>>> Whimsy-vm4 runs Ubuntu 16.04 which comes with Ruby 2.4.
>>> 
>>> Sebb is working on getting whimsy-vm5 up and running on Ubuntu 18.04
>>> which comes with Ruby 2.5.
>>> 
>>>> Anyway, I rebooted and still no joy. None of these urls succeed:
>>>> whimsy.local hangs forever
>>>> whimsy.local:3000 hangs forever
>>> 
>>> That's defined using IPv6.
>>> 
>>>> 0.0.0.0 Safari can't connect to the server
>>>> 0.0.0.0:3000 Safari can't connect to the server
>>> 
>>> We've established that Safari can't talk to 0:0:0:0.
>>> 
>>> Lets try something different.  What does the following do on your machine?
>>> 
>>> ---
>>> require 'socket'
>>> server = TCPServer.new 5678
>>> ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address
>>> 
>>> Thread.new do
>>> sleep 1
>>> puts "open http://#{ip}:5678/ <http://#{ip}:5678/>"
>>> system "open http://#{ip}:5678/ <http://#{ip}:5678/>"
>>> end
>>> 
>>> while session = server.accept
>>> response = "Hello world! The time is #{Time.now}\n"
>>> session.print "HTTP/1.1 200 OK\r\n" +
>>>    "Content-Type: text/plain\r\n" +
>>>    "Content-Length: #{response.bytesize}\r\n" +
>>>    "Connection: close\r\n\r\n" +
>>>    response
>>> session.close
>>> end
>>> ---
>>> 
>>> - Sam Ruby
>> 
>> Craig L Russell
>> c...@apache.org
>> 

Craig L Russell
c...@apache.org

Reply via email to