home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.univie.ac.at!blekul11!frmop11!barilvm!vms.huji.ac.il!wisipc.weizmann.ac.il!menora.weizmann.ac.il!dov
- Newsgroups: comp.lang.perl
- Subject: Re: select misses pending data on socket
- Message-ID: <1992Sep2.122937.15736@wisipc.weizmann.ac.il>
- From: dov@menora.weizmann.ac.il (Dov Grobgeld)
- Date: Wed, 2 Sep 1992 12:29:37 GMT
- Sender: news@wisipc.weizmann.ac.il
- References: <1992Sep1.213109.26481@netlabs.com>
- Organization: Weizmann Institute of Science, Computation Center.
- Lines: 48
-
- lwall@netlabs.com (Larry Wall) writes:
- : In article <1992Aug31.201931.14111@uvaarpa.Virginia.EDU> dov@menora.weizmann.ac.il writes:
- : : The print line of $rout shows that select reports that there is no data
- : : to be read on the socket. How can that be?
- :
- : Because there isn't any data to be read on the socket. It's already been
- : read into the stdio buffers.
- :
- : Don't use select with <>. Use sysread() or recv() instead.
- :
- : I suppose I really ought to make select work with stdio, but that can
- : get gory...
- :
- : Larry
-
- So many strange functions (select(), recv(), sysread(), fileno(), vec() )
- to do the conceptually simple task of:
-
- "Check if there are apples under the tree, and if so, pick them,
- but don't hang around waiting for them to fall."
-
- I'm used to it being very simple to implement well defined problems
- like this in Perl (yes, I'm spoiled ;-), but this seems to be an exception.
-
- It seems like the socket related functions, as opposed to the rest of
- Perl, are just directly copied versions of the underlying Unix functions.
- If socket support was provided in a different operating system, it
- wouldn't map very well to these function names I believe.
-
- Anyhow, I seem to have gotten to grips with these calls now and have
- rewritten the client program from the Camel book without any forks.
- Perhaps such a program should be included in the next version (generation)
- of the (family of) Camel(s).
-
- Just one more question about the sockets. How do I detect if the server
- I'm connected to has closed down the connection?
-
- @apple= ("Just ","Another ","Perl ","Hacker,"); $tree=0; $branch=1;
- print while $_ = splice(@apple,$tree,$branch);
-
- --
- ___ ___
- / o \ o \
- Dov Grobgeld ( o o ) o |
- The Weizmann Institute of Science, Israel \ o /o o /
- "Where the tree of wisdom carries oranges" | | | |
- _| |_ _| |_
-
-