I''m writing a gem which binds multiple sockets to the same UDP
multicast port, basically like so..
socket = UDPSocket.new
socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT,
[1].pack("i_") )
socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP,
addresses)
socket.bind(Socket::INADDR_ANY, port)
data, meta = socket.recvfrom 1024
..which is working fine.. in OS X. But no love on my Solaris 10 x64
box. The problem? AFAICT, the available options come straight from
the platforms C setsockopt implementation, which is platform
dependent, and SO_REUSEPORT isn''t defined on Solaris. I
haven''t
gotten to Windows yet but I''m guessing I''ll have the same
issue.
So, it seems that Ruby''s socket library is a bit fubar in that
Socket''s constants..
irb(main):008:0> Socket.constants.sort.each do |c| p c; end
..vary by platform. Anyone have a Better Way of binding twice (or
more) to the same UDP multicast port--or doing any low-level socket
stuff--in a cross-platform-sane manner?
Preston
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---