Incorrect error code with TCPServer.new
---------------------------------------

                 Key: JRUBY-4233
                 URL: http://jira.codehaus.org/browse/JRUBY-4233
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
            Reporter: David Calavera
         Attachments: 0001-Incorrect-error-code-with-TCPServer.new.patch

Reported by Vivek Pandey in the users mailing list:
{noformat}
I have this script and I expect EADDRNOTAVAIL error but jruby gives wrong error 
code:

require 'socket'
x = TCPServer.new "1.2.3.4", 4000


Above script gives the following error on MRI on Mac (snow leopard), ruby 1.8.7 
(2008-08-11 patchlevel 72) [universal-darwin10.0]:

Errno::EADDRNOTAVAIL: Can't assign requested address - bind(2)
        from (irb):2:in `initialize'
        from (irb):2:in `new'
        from (irb):2

Using jruby it gives a different error:

Errno::EADDRINUSE: Address already in use - Address in use
        from (irb):3:in `initialize'
        from (irb):3:in `new'
        from (irb):3

jruby version is:

jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 
64-Bit Server VM 1.6.0_15) [x86_64-java]
{noformat}

I attach a tiny patch that solves the bug, new rubyspecs to test this and other 
errors in TCPServer.new are comming

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to