Here is the final code I generated:

sub make_server { my ($ipv6,$localHost,$conn,$protocol,$socket_port,$verbose) = @_; my $server; print "Using protocol = $protocol on $localHost with port = $socket +_port.\n" if $verbose; if ($ipv6) { print "Running IPv6 tests.\n" if $verbose; $server = IO::Socket::INET6->new(LocalAddr => "$localHost:$soc +ket_port", Proto => $protocol, Reuse => 1, Listen => $conn) or die "Couldn't make IPv6 server on port $socket_port: $@\n"; print "Running IPv6 enabled on port $socket_port.\n" if $verbos +e; } else { print "Running IPv4 tests.\n" if $verbose; $server = IO::Socket::INET->new(LocalAddr => "$localHost:$sock +et_port", Proto => $protocol, Reuse => 1, Listen => $conn) or die "Can't make $protocol server on port $socket_port: $@\n +"; print "Running on port $socket_port.\n" if $verbose; } return($server); }

A little about this code....it's made to use the $protocol flag to handle some test cases for TCP and UDP, the Server starts up and handles a Client that connects using similar code to start up with the same conditions. What I was trying to handle was not only IPv4 but IPv6, plus conditions for TCP and UDP so I can just send flags to the creation of the Server or Client and have them generate what I need.

Of course none of this addresses the fact that I also need to make something with Named Pipes for Windows, but that's another story.


In reply to Re^2: Getting IPv6 with the Cookbook by gokuraku
in thread Getting IPv6 with the Cookbook by gokuraku

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.