|
From: Chris H. <chr...@ni...> - 2002-03-12 09:02:37
|
On Mon, Mar 11, 2002 at 07:03:56PM -0500, Jason Boxman wrote:
> I noticed this in the docs, and I don't know how difficult it would be to
> solve it:
>
> "Bug the first:
>
> NetServer::Generic attempts to make it easy to write a
> server by letting the programmer concentrate on reading
> from STDIN and writing to STDOUT. However, this form of
> i/o is line oriented. NetServer::Generic relies on the
> buffering and i/o capabilities provided by Perl and
> IO::Socket respectively. It doesn't buffer its own input."
>
> The examples show something like:
>
> while (defined ($tmp = <STDIN>)) { }
>
> Couldn't you do a sysread() instead so that you could pull in blocks of input
> from the client (apt-get) and the server (debian mirror) where STDIN will
> play a role?
I'm no expert, but looking at the manpage for sysread I can't see how you
can say 'pull in this amount of input until a newline or you read a maximum
length' with sysread. Is it possible to specify nonblocking behaviour, so
that it would return immediately even if the client hadn't sent LENGTH
bytes?
Chris
|