Re: Help getting started with libwww
On Wed, 31 May 1995, Rainer Klute wrote:
> >Setting up a stream to collect the chunks is what I do not understand how
> >to do in C, in a single process. Could you elaborate?
> The stream should collect all incoming data in a large buffer and
> send it off to the widget when the stream is closed.
Right, I understand the concept, what I don't understand is the mechanics.
Let me be more specific. I know I have to build an HTRequest structure,
and in its output_stream field, I need a stream. I know that I can get one
by calling HTWriter_new() with a file descriptor. But where does that file
descriptor come from?
Should I open one with pipe()? That seems to work, but if my read routine
is in the same process as the library write routine, won't it break down
if the retrieved data is greater than the pipe buffer size? I.e. the
libwww write routine will hang when the pipe is full, but my read routine
won't get called to empty the pipe because the whole process will be hung.
I could just have two processes, but that seems like excessive overhead,
and probably is not the correct style.
Should I actually open a file, and use that file descriptor? That is what
I am doing now, and it works, but it also seems like a waste. But does the
library always write a temporary cache file anyway? Should I use that? I
could not understand how to get HTSaveAndCallBack() to work, and the
comment in the text discourages its use.
Should I use a socket? That would have the same problem as a pipe in a
single process, but with more overhead, wouldn't it? I could use an
AF_UNIX socket I suppose, which would not fill up and block, but then I
have the unneeded creation of a file.
So, what do I use as the file descriptor?
= Matthew M. Freedman =
= U. of Washington Information Systems email@example.com =
= 4545 15th Ave. NE; 3rd Floor (206) 543-5593 =
= Seattle, WA 98105 =