JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-4995

On Windows, Socket constants do not agree with MRI's, and BasicSocket#setsockopt fails when MRI does not.

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.5.1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Extensions, Windows
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      Using "sim.rb" from http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/a79b38dd94e23b3b/0847b57566c600cb?lnk=raot&fwc=2

      ruby sim.rb r 3302 229.1.1.1 5000

      works

      jruby however reports:

      C:\dev\ruby>D:\installs\jruby-1.5.1\bin\jruby sim.rb r 3302 229.1.1.1 5000
      Run using bindata and win32-console
      1
      #<UDPSocket:0x3ca754>
      sim.rb:85:in `initialize': Protocol not available - Protocol not available (Errno::ENOPROTOOPT)

        Activity

        Hide
        Hiro Asari added a comment - - edited

        The script in question is http://www.ruby-forum.com/attachment/4309/sim.rb; it requires 'bindata' gem.

        I am changing the summary, because I believe that multicasting doesn't come into play when JRuby raises the error it does.

        First: notice that, in JRuby on Windows, constantine, a.k.a. jnr-constants, Socket constants default to some wacky values for Socket::IN* and Socket::IPPROTO*.

        Second: in RubyBasicSocket.setsockopt, JRuby raises this error if we do not get Socket::IPPROTO_TCP and Socket::TCP_NODELAY as arguments. I am not sure if this is the correct behavior. I'll have to look further.

        Show
        Hiro Asari added a comment - - edited The script in question is http://www.ruby-forum.com/attachment/4309/sim.rb ; it requires 'bindata' gem. I am changing the summary, because I believe that multicasting doesn't come into play when JRuby raises the error it does. First: notice that, in JRuby on Windows, constantine, a.k.a. jnr-constants, Socket constants default to some wacky values for Socket::IN* and Socket::IPPROTO*. Second: in RubyBasicSocket.setsockopt, JRuby raises this error if we do not get Socket::IPPROTO_TCP and Socket::TCP_NODELAY as arguments. I am not sure if this is the correct behavior. I'll have to look further.
        Hide
        Charles Oliver Nutter added a comment -

        As I mentioned in the other bug, we should move these constants to constantine and try to get them matching platform-native values.

        Show
        Charles Oliver Nutter added a comment - As I mentioned in the other bug, we should move these constants to constantine and try to get them matching platform-native values.
        Hide
        Charles Oliver Nutter added a comment -

        At some point all of these values were moved into jnr-constants (nee constantine), and setsockopt got a rework for JRuby 1.7.

        Show
        Charles Oliver Nutter added a comment - At some point all of these values were moved into jnr-constants (nee constantine), and setsockopt got a rework for JRuby 1.7.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Roger Pack
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: