>>>>> "MTM" == Mike T Machenry <[EMAIL PROTECTED]> writes:

  MTM> use IO::Socket;
  MTM> $sock = new IO::Socket (...);
  MTM> die unless $sock;
  MTM> while ($newsock = $sock->accept()) {
  MTM>   while (defined ($buf = <$newsock>)) {
  MTM>     print $buf;
  MTM>   }
  MTM> }
  MTM> close ($sock);

  MTM> It is my understanding the accept() awaits a new connection from
  MTM> a client and blocks until it is read. This is my experience with
  MTM> running the program aswell. However this program leads me to
  MTM> believe that accept is going to return a false value and fall
  MTM> through to the close. If it is a blocking method that awaits a
  MTM> connection, how could it possibly know that no connection is
  MTM> comming and it should close($sock)?

you are basically correct there. accept on a listen socket will
generally work like you think. but the solaris man page shows at least
11 possible error conditions for accept. and with kernel calls it is
always a good idea to check for errors.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to