socket problem on Windows? 
Author Message
 socket problem on Windows?

Hello,

I'm new to Ruby.  I've written a very simple program.  It will not run on
Windows XP (at work), but it will run on Mac OS X (at home).  I've tried
1.6.8 and 1.8.0 preview 2 on Windows XP and 1.6.7 on Mac OS X.  Here's the
code:

require 'resolv'

class ResolverTest
    def run()
        dns = Resolv::DNS.new
        dns.getresources("www.apogent.com",
Resolv::DNS::Resource::IN::A).collect {|r| r.address}
        puts("#{r}\n")
    end
end

resolver = ResolverTest.new()
resolver.run()

Here's the error:

C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:559:in `connect': The
requested address is not valid in its context. - "connect(2)"
(Errno::E10049)
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:559:in `initialize'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:351:in `new'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:351:in `lazy_initialize'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:346:in `synchronize'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:346:in `lazy_initialize'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:413:in `each_resource'
 from C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:408:in `getresources'
 from C:\projects\test\ruby\TestProject/ResolverTest.rb:6:in `run'
 from C:\projects\test\ruby\TestProject/ResolverTest.rb:12

Please share any ideas that you may have regarding this problem.

Thanks,
Craig



Mon, 28 Nov 2005 22:44:23 GMT  
 socket problem on Windows?

Quote:

> I'm new to Ruby.  I've written a very simple program.  It will not run on
> Windows XP (at work), but it will run on Mac OS X (at home).  I've tried
> 1.6.8 and 1.8.0 preview 2 on Windows XP and 1.6.7 on Mac OS X.  Here's the
> code:

Don't know, but it breaks on win2k too.


Mon, 28 Nov 2005 23:08:45 GMT  
 socket problem on Windows?

Quote:

> Hello,

[snip]

Quote:
> Here's the code:

> require 'resolv'

> class ResolverTest
>     def run()
>         dns = Resolv::DNS.new
>         dns.getresources("www.apogent.com",
> Resolv::DNS::Resource::IN::A).collect {|r| r.address}
>         puts("#{r}\n")
>     end
> end

> resolver = ResolverTest.new()
> resolver.run()

> Here's the error:

> C:/devtools/ruby/1.6.8/lib/ruby/1.6/resolv.rb:559:in `connect': The
> requested address is not valid in its context. - "connect(2)"
> (Errno::E10049)

[snip]

Apparently, there is a patch for "resolv.rb" on win32 which you may need to
apply.
I don't know if this has been recently discussed on ruby-talk but I found
this old reference on
ruby-dev  which is a clue:
-----------------------------------------------------
Subject: [ruby-dev:16289] win32/registry.rb and resolv.rb patch for win32
platform

Date: Fri, 8 Mar 2002 20:58:48 +0900)
-----------------------------------------------------

Searching on ruby-talk for resolv.rb brings back quite a few threads, which
you
may have to trawl through. Of course, there are very knowledgeable Rubyzens
here
who might have a direct answer.



Tue, 29 Nov 2005 11:16:23 GMT  
 socket problem on Windows?

Quote:

> Apparently, there is a patch for "resolv.rb" on win32 which you may
> need to apply.

I was able to ugly-hack this file till the error shifted to :

   C:/ruby/lib/ruby/1.8/resolv_new.rb:614:in `fcntl': The fcntl() function
                is unimplemented on this machine (NotImplementedError)

and then I gave up.



Tue, 29 Nov 2005 11:19:40 GMT  
 socket problem on Windows?
Hello,

In message "Re: socket problem on Windows?"

| Apparently, there is a patch for "resolv.rb" on win32 which you may need to
| apply.
| I don't know if this has been recently discussed on ruby-talk but I found
| this old reference on
| ruby-dev  which is a clue:
| -----------------------------------------------------
| Subject: [ruby-dev:16289] win32/registry.rb and resolv.rb patch for win32
| platform

| Date: Fri, 8 Mar 2002 20:58:48 +0900)
| -----------------------------------------------------

Here is most recently version of this patch.
  http://www.moonwolf.com/~arcml/cgi-bin/arcml/arcml.cgi?rm=view;list_i...

We are working to import the patch to 1.8 release.
But there are some problems, so I doubt we cannot include it
in the release.

Regards,
--



Tue, 29 Nov 2005 11:36:13 GMT  
 socket problem on Windows?
Many thanks to those who responded.  I will investigate your ideas when I am
able to resume my exploration of Ruby, which is likely next week some time.

Regards,
Craig



Tue, 29 Nov 2005 22:49:27 GMT  
 socket problem on Windows?

Quote:

> I will investigate your ideas when I am
> able to resume my exploration of Ruby, which is likely next week some

time.

Make sure that you download the latest patch (see U.Nakamura's post for URL)
I tried it on my WinXP Pro and it worked.

Best of luck !
-- shanko



Wed, 30 Nov 2005 02:19:35 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. socket problems under windows: cannot load Socket.so under windows

2. UDP Socket Problem under Windows

3. socket problem on Windows NT4.0

4. C/Tcl Socket Problem In Windows.

5. problem with windows sockets

6. HELP! problem with socket.makefile under Windows

7. Windows socket problem (as always)

8. socket client/server problem on Windows

9. problem with socket and Windows.

10. Problem with combination of sockets, exec and Windows

11. Problem with sockets under Wish 8.0 under Windows 95

12. Sockets & Threads (Windows)

 

 
Powered by phpBB® Forum Software