1Net::SOCKS(3) User Contributed Perl Documentation Net::SOCKS(3)
2
3
4
6 Net::SOCKS - a SOCKS client class
7
9 Establishing a connection:
10
11 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
12 socks_port => 1080,
13 user_id => 'the_user',
14 user_password => 'the_password',
15 force_nonanonymous => 1,
16 protocol_version => 5);
17
18 # connect to finger port and request finger information for some_user
19 my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);
20 print $f "some_user\n"; # example writing to socket
21 while (<$f>) { print } # example reading from socket
22 $sock->close();
23
24 Accepting an incoming connection:
25
26 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
27 socks_port => 1080,
28 user_id => 'the_user',
29 user_password => 'the_password',
30 force_nonanonymous => 1,
31 protocol_version => 5);
32
33 my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "128.10.10.11",
34 peer_port => 9999);
35
36 $f= $sock->accept();
37 print $f "Hi! Type something.\n"; # example writing to socket
38 while (<$f>) { print } # example reading from socket
39 $sock->close();
40
42 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
43 socks_port => 1080,
44 user_id => 'the_user',
45 user_password => 'the_password',
46 force_nonanonymous => 1,
47 protocol_version => 5);
48
49 To connect to a SOCKS server, specify the SOCKS server's
50 hostname, port number, SOCKS protocol version, username, and
51 password. Username and password are optional if you plan
52 to use a SOCKS server that doesn't require any authentication.
53 If you would like to force the connection to be
54 nonanoymous, set the force_nonanonymous parameter.
55
56 my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);
57
58 To connect to another machine using SOCKS, use the connect method.
59 Specify the host and port number as parameters.
60
61 my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "192.168.1.3",
62 peer_port => 9999);
63
64 If you wanted to accept a connection with SOCKS, specify the host
65 and port of the machine you expect a connection from. Upon
66 success, bind() returns the ip address and port number that
67 the SOCKS server is listening at on your behalf.
68
69 $f= $sock->accept();
70
71 If a call to bind() returns a success status code SOCKS_OKAY,
72 a call to the accept() method will return when the peer host
73 connects to the host/port that was returned by the bind() method.
74 Upon success, accept() returns SOCKS_OKAY.
75
76 $sock->close();
77
78 Closes the connection.
79
81 RFC 1928, RFC 1929.
82
84 Clinton Wong, clintdw@netcom.com
85
87 Copyright (c) 1997-1998 Clinton Wong. All rights reserved.
88 This program is free software; you can redistribute it
89 and/or modify it under the same terms as Perl itself.
90
91
92
93perl v5.30.1 2020-01-30 Net::SOCKS(3)