What is it supposed to do?

From what I saw, works fine for me (without anything running on localhost:80, it dies with IO::Socket::INET: Timeout)

I don't own lincoln's book.

update: Anyway, check this out

# from perldoc IO::Select, w/sprinkles by me use strict; use warnings; use IO::Select; use IO::Socket; my $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 8080); my $sel = new IO::Select( $lsn ); my $new; warn "about to enter while"; while(my @ready = $sel->can_read) { warn "in while"; foreach my $fh (@ready) { warn "in foreach"; if($fh == $lsn) { warn "creating a new socket"; # Create a new socket $new = $lsn->accept; $sel->add($new); warn "added new"; } else { warn "processing socket"; warn "read 10 characters and echo them"; read($fh,$_,10); warn "here they are '$_'"; # Process socket # Maybe we have finished with the socket $sel->remove($fh); $fh->close; warn "done with it, neext"; } } } __END__ This is what i got after i ran this script, and then did a\ telnet localhost 8080 hello ther about to enter while at far line 9. in while at far line 11. in foreach at far line 13. creating a new socket at far line 15. added new at far line 19. in while at far line 11. in foreach at far line 13. processing socket at far line 22. read 10 characters and echo them at far line 23. here they are 'hello ther' at far line 25. done with it, neext at far line 30.

____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Multiplexed TCP-Client (from: Networkprogramming with Perl) by PodMaster
in thread Multiplexed TCP-Client (from: Networkprogramming with Perl) by strat

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.