Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I used a little example in this book so that when my Net::FTPServer is down and someone FTP's to it, they get a little message saying "FTP Server is down":
#!/arudev/bin/perl use strict; use IO::Socket qw(:DEFAULT :crlf); $/ = CRLF; my ($bytes_out, $bytes_in, $quit); $SIG{INT} = sub { $quit++ }; my $port = $ENV{ARUFTPD_PORT} || die "ENV{ARUFTPD_POR} not defined"; my $sock = IO::Socket::INET->new( Listen => 20, LocalPort => $port, Timeout => 60*60, Reuse => 1 ) or die "Can't create listening socket: $!\n"; warn "waiting for incoming connection on port $port\n"; while (!$quit) { next unless my $session = $sock->accept; my $peer = gethostbyaddr($session->peeraddr,AF_INET) || $session->peerhost; my $port = $session->peerport; warn "Connection from [$peer,$port]\n"; my $msg = "230- *** SERVER IS DOWN FOR MAINTENANCE***\n"; print $session $msg; open A, '/m/aru/aruftpd/conf/aruftpd_welcome.text'; print $session "230- $_" while (<A>); print $session $msg; close $session; } close $sock;
That being said, if you have a huge networking task to do, it is much better to look at Event, ParallelForkManager, POE , or Stem to save yourself more than just time.

And a final thing about this book is the author. Lincoln Stein is a very responsive person when you have an issue with his books or software, often getting back within one hour. And what else gets me is that this guy has an MD. I mean, I have 2 degrees in Comp. Sci. and one in Computational Neuroscience and I still can't touch his expertise in Perl. Damn!


In reply to Re: Network Programming With Perl by princepawn
in thread Network Programming With Perl by jeffa

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (5)
    As of 2021-04-18 03:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?