The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::SOCKS - a SOCKS client class

SYNOPSIS

 Establishing a connection:

 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
                socks_port => 1080,
                user_id => 'the_user',
                user_password => 'the_password',
                force_nonanonymous => 1,
                protocol_version => 5);

 # connect to finger port and request finger information for some_user
 my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);
 print $f "some_user\n";    # example writing to socket
 while (<$f>) { print }     # example reading from socket
 $sock->close();

 Accepting an incoming connection:

 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
                socks_port => 1080,
                user_id => 'the_user',
                user_password => 'the_password',
                force_nonanonymous => 1,
                protocol_version => 5);

 my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "128.10.10.11",
                        peer_port => 9999);

 $f= $sock->accept();
 print $f "Hi!  Type something.\n";    # example writing to socket
 while (<$f>) { print }                # example reading from socket
 $sock->close();

DESCRIPTION

 my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
                socks_port => 1080,
                user_id => 'the_user',
                user_password => 'the_password',
                force_nonanonymous => 1,
                protocol_version => 5);

  To connect to a SOCKS server, specify the SOCKS server's
  hostname, port number, SOCKS protocol version, username, and
  password.  Username and password are optional if you plan
  to use a SOCKS server that doesn't require any authentication.
  If you would like to force the connection to be 
  nonanoymous, set the force_nonanonymous parameter.

 my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);

 To connect to another machine using SOCKS, use the connect method.
 Specify the host and port number as parameters.

 my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "192.168.1.3",
                        peer_port => 9999);

  If you wanted to accept a connection with SOCKS, specify the host
  and port of the machine you expect a connection from.  Upon
  success, bind() returns the ip address and port number that
  the SOCKS server is listening at on your behalf.

 $f= $sock->accept();

  If a call to bind() returns a success status code SOCKS_OKAY,
  a call to the accept() method will return when the peer host
  connects to the host/port that was returned by the bind() method.
  Upon success, accept() returns SOCKS_OKAY.

 $sock->close();

  Closes the connection.

SEE ALSO

 RFC 1928, RFC 1929.

AUTHOR

 Clinton Wong, clintdw@netcom.com

COPYRIGHT

 Copyright (c) 1997-1998 Clinton Wong. All rights reserved.
 This program is free software; you can redistribute it
 and/or modify it under the same terms as Perl itself.