In the first edition of Programming Perl there was an example program called receptionist which provided similar functionality to inetd. Of course it is perl 4 but despite the fact that you would probably do things differently now it is still a good example.

The examples can be found at ftp://ftp.ora.com/published/oreilly/perl/programming_perl/perl.tar.Z

Added Later:
Well of course I started to think about this and wondered how I might do this on windows and I came up with this basic example:

#!/usr/bin/perl -w use strict; use Socket; use IO::Select; use IO::Socket; my $select = IO::Select->new(); while(<DATA>) { chomp; if ( my $server = IO::Socket::INET->new(LocalPort => $_, Listen => 10, ReuseAddr => 1) ) { $select->add($server); } } while(1) { foreach my $ready ($select->can_read(1)) { my $client = $ready->accept(); print inet_ntoa($client->peeraddr()), " ",$client->sockport(),"\n"; } } __DATA__ 2048 2049 2060

The ports that you want to monitor are the numbers after the __DATA__ . You can probably take the rest from there :)

/J\


In reply to Re: Getting backsniff from Cookbook to work under Windows by gellyfish
in thread Getting backsniff from Cookbook to work under Windows by rchiav

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.