Ruby ipv6 socket error

I want use ruby ipv6 socket
i write some test program at linux platform.

1
///////////////////////////////////////////////////////////////////////
require ‘socket’
socket=UDPSocket.new(Socket::AF_INET6)
socket.bind("::1",12121)
loop do
msg,sender=socket.recvfrom(100)
host=sender[3]
puts “#{Time.now}:#{host} ‘#{msg}’”
end
///////////////////////////////////////////////////////////////////////
it is right,server can receive client message.

2
///////////////////////////////////////////////////////////////////////
require ‘socket’
socket=UDPSocket.new() #Socket::AF_INET6
socket.bind(“fe80::218:8bff:fe0d:e27c”,12121) #linux ipv6 link
address
loop do
msg,sender=socket.recvfrom(100)
host=sender[3]
puts “#{Time.now}:#{host} ‘#{msg}’”
end
///////////////////////////////////////////////////////////////////////
Error the tip message is
in ‘connect’:Invalid argument - connect(2) (Errno::EINVAL) from server 5

someone can help me .why this simple program have error.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs