Thanks for all the tips, here and in various books and places that monks frequent outside the monestry.

This is what I have to date, a few little issues to sort out
#!/usr/local/bin/perl -w # modules required use strict; use IO::Socket; use IO::Tee; use Fcntl; # get port number and server IP my $SERVICE = <DATA>; my $REMOTE = <DATA>; # connection to remote server (data source) my $remote = new IO::Socket::INET( PeerPort => $SERVICE, PeerAddr => $REMOTE, Proto => 'tcp', Type => SOCK_STREAM, ) or die "Can't connect: $!\n"; # local port to accept connections from probes my $local = new IO::Socket::INET( LocalPort => $SERVICE, Proto => 'tcp', Listen => 3, Reuse => 1, ) or die "Can't create server : $!\n"; # make local ports non-blocking fcntl($local,F_SETFL, fcntl($local,F_GETFL,0) | O_NONBLOCK); # build a hash for client connections # use a STDOUT so I can see what's happening on server locally. # can drop for production my %clients = ("StdOut"=>\*STDOUT,); my $buf; # loop forever while (1) { # if a probe connects add details to hash my $client = $local->accept(); $clients{$client} = $client if $client; # this bit remove clients that have disconnected foreach (keys %clients) { delete $clients{$_} if ($_ ne "StdOut" and !$clients{$_}-> +connected()); } # send data to all connected clients my $tee = IO::Tee->new(values %clients); print $tee $buf if (defined $remote and $buf = <$remote>); } __END__ 8099 <server ip goes here>

In reply to Re^2: Port duplicator by tweetiepooh
in thread Port duplicator by tweetiepooh

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.