You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Note that it is not guaranteed to be able to convert to IP address using gethostbyname, getaddrinfo, etc.
* If you need local IP address, use Socket.ip_address_list.
We can use something like:
Socket.ip_address_list.select do |address|
if address.ipv4?
not address.ipv4_multicast? and not address.ipv4_private?
else
not address.ipv6_linklocal?
end
end
.map do |address|
address.ip_address
end
Thank you.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Related
jruby
issue.rvm use jruby-9.1.6.0
Try to start
sinatra
app with jruby.Expected behavior
Server will be accessible on both
127.0.0.1
and::1
.Actual behavior
Server is accessible only on
127.0.0.1
System configuration
Ruby version: jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 OpenJDK 64-Bit Server VM 25.101-b13 on 1.8.0_101-b13 +jit [linux-x86_64]
Fix
You are using
TCPSocket.gethostbyname "localhost"
here to get the list of localhost addresses.In MRI ruby we have a comment:
We can use something like:
Thank you.
The text was updated successfully, but these errors were encountered: