I've been looking around, and I can't find any way to modify the Time To Live value of a TCP socket. The only references I've found online refer to IO::Socket::Multicast, which aren't helpful. It also doesn't help that searching for TTL often brings up words such as 'little'. Is this possible to do, or am I can to have to use another module - if so, which would you recommend. Thanks, ~muto Update: Ok, I've been looking at using using Socket. However, when I run my script, I get the following error: Your vendor has not defined Socket macro IP_TTL, used at K:\perl\firewalk.pl line 17 Anyone know what's wrong? I'm on Activeperl 5.10, Windows XP SP 2.
#!/usr/bin/perl -w use Socket; $remote = $ARGV[0]; $port = 80; if($port =~ /\D/) { $port = getservbyname($port, 'tcp') } die "no port specified" unless $port; $iaddr = inet_aton($remote) || die "$remote"; $paddr = sockaddr_in($port, $iaddr); $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "cannot open socket +: $!"; setsockopt (SOCK,IPPROTO_IP,IP_TTL,1); connect(SOCK, $paddr) || die "cannot connect to $remote: $!"; close(SOCK);

In reply to IO::Socket TTL? by muto

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.