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

Network Programming With Perl

by jeffa (Bishop)
on Feb 04, 2001 at 08:58 UTC ( #56273=bookreview: print w/replies, xml ) Need Help??
Order Network Programming With Perl

Item Description: Licoln D. Stein's book of wonders

Review Synopsis: Everything about network programming with Perl

I love O'reilly. But I also love Addison Wesley. Lincoln D. Stein's newest title under Addison Wesley is a massive collection of examples and explanations of the how's and why's of network programming.

For the advanced network programmer, there is probably not much to offer - although there is always some little detail that even the most experienced guru will overlook. Such is the nature of our trade. With so much information, it's hard to learn it all - and especially if you are an initiate, it seems impossible. This book manages to be a great introduction AND a great reference book at the same time - 650 pages total (not including appendices and the index).

But for those who are not gurus in network programming, this is the book to start with.

Network Programming With Perl starts off not with networks, but instead with basic I/O. Stein shows how a Perl script that reads from a socket is very similar to one that reads from a local filehandle (actually, only one line is different). The concepts of blocking and buffering are covered within chapter 1 - pipes, signals, and forking are covered in chapter 2. Once these basic building blocks are understood by the reader, the rest of the material in the book becomes much clearer.

Many useful CPAN modules are covered in this book:

  • IO::File, IO::Handle, IO::Socket,
  • Socket
  • Net::Ftp, Net::Telnet, Net::SMTP
  • LWP
  • HTML::Parser
  • and many, many more

The first four chapters are the basics, the next five serve as a cookbook for writing various TCP/IP clients, such as FTP, POP, and LWP user agents. Chapters 10 through 16 cover the meat and potatoes of server programming: forking servers, daemons, inetd, some experimental 5.005 version multi-threading, multiplexing with IO::Select, nonblocking I/O, and a whole chapter on 'bullet-proofing' server code.

The last chapters cover more specialized areas, such as UDP chat servers, broadcasting, and multicasting. I wish an example of multicasting mp3's across a network would have been covered, but with the infomation provided, coding such an application should prove to be fairly simple.

The layout of the book is wonderful. There are many examples of code, and I really like the way various function explanations are presented. Platform independance is a goal in this book. Windows and Macintosh are covered as well as Unix, but the last chapter is dedicated soley to Unix: Unix-Domain sockets.

Network Programming With Perl covers some of the same material that can be found in the Perl Cookbook, but it has a clear direction that will prove to be beneficial to anyone wishing to travel it.

Replies are listed 'Best First'.
Re: Network Programming With Perl
by Rex(Wrecks) (Curate) on Aug 31, 2001 at 23:42 UTC
    I have not been using Perl very long, and I now have to use it a lot for work. So for learning I naturally picked up several books and started to go. I used the Camel a lot at first for basics, and then the Cookbook as well. Since I'm writing a lot of code to test network devices I picked up this book a little later.

    Wow, this is a superbly written book! Full programs explained line by line, creating modules made easy, using CPAN and it's many wonders, its all in here.

    This book not only showed me how to network in Perl, but also how to write better Perl and gave me (as a newbie) an easy Warp into some of the more advanced Perl stuff.

    If you are a Newbie and have any interest in network programming whatsoever...BUY THIS BOOK!

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Network Programming With Perl
by GrandMasterCurl (Initiate) on Aug 29, 2001 at 22:30 UTC
    This book puts learning ahead of teaching. Working through Stein's examples and explainations is as much fun as it is educational. A must have for anyone getting into networking.
Re: Network Programming With Perl
by princepawn (Parson) on Sep 01, 2001 at 00:15 UTC
    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!

Re: !--review--Network Programming With Perl
by DigitalKitty (Parson) on Apr 06, 2002 at 17:03 UTC
    I agree with Jeffa completely. Dr. Stein does a fantastic job explaining / demonstrating everything from sophisticated IO, forking, sockets, chat applications, etc. I would suggest though, the reader have some previous perl experience as the pace is somewhat quick. If one has finished the Llama book ( at least ), they should be reasonably prepared for the experience that is this text.

Re: Network Programming With Perl
by Hanamaki (Chaplain) on Sep 06, 2001 at 20:36 UTC
    Additional information:
    The TOC, preface, chapter 6 on FTP and Telnet, and chapter 19 on UDP Servers you will find as full text at the books homepage.

      That link doesn't seem to be valid any more, but Google Books has most of the book available as a preview.
Re: !--review--Network Programming With Perl
by TheHobbit (Pilgrim) on Apr 18, 2002 at 22:51 UTC

    I'd just like to say that I use this book as a basis for the programming part of my university networks' courses.

    Leo TheHobbit
    GED/CS d? s-:++ a+ C++ UL+++ P+++>+++++ E+ W++ N+ o K? !w O? M V PS+++
    PE-- Y+ PPG+ t++ 5? X-- R+ tv+ b+++ DI? D G++ e*(++++) h r++ y+++(*)
Re: Network Programming With Perl
by Frantz (Monk) on Jan 24, 2005 at 15:15 UTC
    A very great book, which give basis on netwok and system programming
Re: Network Programming With Perl
by spx2 (Deacon) on May 02, 2009 at 23:57 UTC
    I'd like to say that the mechanisms described from the perspective of the language where they've been implemented into. Lincoln D. Stein does not do his best to describe the mechaisms , so one can not really go in depth with this book. The APUE book however is much better suited for learning these kinds of things because it exposes one to exactly what system calls are made at each step , and goes as far as to implementing some of the functions which cannot be understood so easily just be reading the manpage or Stein's book. But I am biased , I don't like to treat things as black-boxes when , I want to really know what I'm doing so maybe other people want to read and apply things faster.
Re: Network Programming With Perl
by Anonymous Monk on May 14, 2004 at 08:45 UTC
    I suppose that the book is great but can n00bs in Network Programming With Perl can learn from it ?

      Anyone can learn from it if they apply themselves. Anyone can do just about anything if they act upon their desire to do so. Will there be parts that you don't understand immediately? Of course. Can you move to the next subject and come back later? You bet. I don't think i can stress "training with a professional" enough -- be that finding the local guru in your neighborhood or school, signing up for Technology courses at the local university, community college, etc., or signing up here and listening to the Monks' advice. Whatever it takes, find a peer or a guru to help you. And don't forget that it really takes about 10 years to become a great programmer.


      (the triplet paradiddle with high-hat)
Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: bookreview [id://56273]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2023-10-02 22:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found