Forum: Ruby Does SOCKSSocket work?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Edfcfb783260609029d57cd4e1c39d65?d=identicon&s=25 Alan Johnson (Guest)
on 2008-11-18 01:19
(Received via mailing list)
I am having trouble with class SOCKSSocket.  I am trying to get the
following minimal example to work:
require 'socket'
s = SOCKSSocket.new('www.google.com', 80)

Running this I get:
$ ruby example.rb
example.rb:2: uninitialized constant SOCKSSocket (NameError)

First, I assume that SOCKS support must be compiled into ruby, but I
cannot
determine which set of compile flags enables it. Second, looking at the
ruby
source code, it appears that the only SOCKSSocket methods that are even
defined are initialize and close, which makes me wonder how it could
possibly work.

If it matters I am using Fedora 9.  Thanks.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2008-11-18 04:14
(Received via mailing list)
Hi,

In message "Re: Does SOCKSSocket work?"
    on Tue, 18 Nov 2008 09:15:04 +0900, "Alan Johnson"
<alan.wayne.johnson@gmail.com> writes:

|I am having trouble with class SOCKSSocket.  I am trying to get the
|following minimal example to work:
|require 'socket'
|s = SOCKSSocket.new('www.google.com', 80)
|
|Running this I get:
|$ ruby example.rb
|example.rb:2: uninitialized constant SOCKSSocket (NameError)
|
|First, I assume that SOCKS support must be compiled into ruby, but I cannot
|determine which set of compile flags enables it. Second, looking at the ruby
|source code, it appears that the only SOCKSSocket methods that are even
|defined are initialize and close, which makes me wonder how it could
|possibly work.

First, you have to specify --enable-socks=true to configure (or
extconf.rb run) with libsocks installed.

Second, that's OK, SOCKSSocket inherits everything else from
TCPSocket.  I myself have not tested SOCKSSocket for a while,
but I assume it still works.

              matz.
Edfcfb783260609029d57cd4e1c39d65?d=identicon&s=25 Alan Johnson (Guest)
on 2008-11-18 10:35
(Received via mailing list)
On Mon, Nov 17, 2008 at 7:10 PM, Yukihiro Matsumoto
<matz@ruby-lang.org>wrote:

> |
> |possibly work.
>
Thanks for the nudge in the right direction.  Everything is working
great
now. To
answer the question in the subject -- yes, SOCKSSocket works, except the
Net::FTP usage of it is broken in the trunk (patch submitted to
ruby-core).
This topic is locked and can not be replied to.