Hi! I'm a new perl programmer, really new. I'm doing a basic program that use Net::SOCKS and connect over SOCKS4 with a telnet server. My code works fine, I did it based on this documentation http://search.cpan.org/~clintdw/SOCKS-0.03/lib/Net/SOCKS.pm My code simple connect to a port like 8010 and 8011 because they are the two ports that my SOCKS servers are configured, however as they are in a test environment they tend to change constantly like the port 8011 changes to a HTTP proxy and consequently SOCKS doesn't work. My solution is to connect to the port and do a connection at it with NET::Socks to make sure it works.
my $sock = new Net::SOCKS(socks_addr => $socksserver, socks_port => $s +ocksport, protocol_version => 5); my $con = $sock->connect(peer_addr => '10.1.1.3', peer_port => 23);
If the $socksserver is running a SOCKS server at port $sockspor it works great and very fast. But for example if at port $sockspor is running a HTTP proxy it takes VERY LONG to return. Like 4 minutes or so, and it's unacceptable. My idea to solve the problem is define a timeout like 10 seconds for Net::Socks connection, however there is no option at documentation and all my tests failed. Any solution please? Thank you

In reply to Net::SOCKS how define timeout? by perlmonks12

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.