# Does SOCKSSocket work?

**URL:** <https://www.ruby-forum.com/t/does-sockssocket-work/153494>\
**Category:** Ruby\
**Created:** [November 18, 2008, 1:19am UTC](https://www.ruby-forum.com/t/does-sockssocket-work/153494 "2008-11-18T01:19:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Alan\_Johnson](https://www.ruby-forum.com/u/Alan_Johnson)\
**Post date:** [November 18, 2008, 1:19am UTC](https://www.ruby-forum.com/t/does-sockssocket-work/153494/1 "2008-11-18T01:19:24Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![Alan\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Alan\_Johnson](https://www.ruby-forum.com/u/Alan_Johnson)\
**Post date:** [November 18, 2008, 4:14am UTC](https://www.ruby-forum.com/t/does-sockssocket-work/153494/2 "2008-11-18T04:14:49Z")

</div>

Hi,

In message “Re: Does SOCKSSocket work?”  
on Tue, 18 Nov 2008 09:15:04 +0900, “Alan Johnson”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://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.

```

---

<div class="post-metadata">

**Author:** ![Alan\_Johnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Alan\_Johnson](https://www.ruby-forum.com/u/Alan_Johnson)\
**Post date:** [November 18, 2008, 10:35am UTC](https://www.ruby-forum.com/t/does-sockssocket-work/153494/3 "2008-11-18T10:35:10Z")

</div>

On Mon, Nov 17, 2008 at 7:10 PM, Yukihiro M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)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).
