Class: SOCKSSocket
- Inherits:
-
TCPSocket
- Object
- IO
- BasicSocket
- IPSocket
- TCPSocket
- SOCKSSocket
- Defined in:
- sockssocket.c,
sockssocket.c
Overview
SOCKS is an Internet protocol that routes packets between a client and a server through a proxy server. SOCKS5, if supported, additionally provides authentication so only authorized users may access a server.
Instance Method Summary collapse
-
#close ⇒ Object
Closes the SOCKS connection.
-
#new(host, serv) ⇒ Object
constructor
Opens a SOCKS connection to
host
via the SOCKS serverserv
.
Methods inherited from TCPSocket
Methods inherited from IPSocket
#addr, getaddress, #peeraddr, #recvfrom
Methods inherited from BasicSocket
#close_read, #close_write, #connect_address, do_not_reverse_lookup, #do_not_reverse_lookup, do_not_reverse_lookup=, #do_not_reverse_lookup=, for_fd, #getpeereid, #getpeername, #getsockname, #getsockopt, #local_address, #recv, #recv_nonblock, #recvmsg, #recvmsg_nonblock, #remote_address, #send, #sendmsg, #sendmsg_nonblock, #setsockopt, #shutdown
Constructor Details
#new(host, serv) ⇒ Object
Opens a SOCKS connection to host
via the SOCKS server serv
.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'sockssocket.c', line 21
static VALUE
socks_init(VALUE sock, VALUE host, VALUE serv)
{
static int init = 0;
if (init == 0) {
SOCKSinit("ruby");
init = 1;
}
return rsock_init_inetsock(sock, host, serv, Qnil, Qnil, INET_SOCKS);
}
|
Instance Method Details
#close ⇒ Object
Closes the SOCKS connection.
39 40 41 42 43 44 45 46 47 |
# File 'sockssocket.c', line 39
static VALUE
socks_s_close(VALUE sock)
{
rb_io_t *fptr;
GetOpenFile(sock, fptr);
shutdown(fptr->fd, 2);
return rb_io_close(sock);
}
|