File:  [Public] / libwww / Library / src / HTBufWrt.html
Revision 2.7: download - view: text, annotated - select for diffs
Fri Nov 11 14:03:15 2005 UTC (18 years, 6 months ago) by vbancrof
Branches: MAIN
CVS tags: candidate-5-4-1, HEAD
add extern c and HTFile_dirent_buf_size

<HTML>
<HEAD>
  <!-- Changed by: Henrik Frystyk Nielsen, 13-Apr-1996 -->
  <NEXTID N="z18">
  <TITLE>W3C Sample Code Library libwww Buffered Socket Writer Stream</TITLE>
</HEAD>
<BODY>
<H1>
  Buffered Socket Writer Stream
</H1>
<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
The Buffered Socket Writer Stream is an <A HREF="HTIOStream.html">output
stream </A>&nbsp;which knows how to write to a BSD type socket. It is part
of the <A HREF="WWWTrans.html">Transport interface </A>and may be registered
as part of a <A HREF="HTTrans.html">Transport Object</A>. The application
can&nbsp;initialize this stream together with the
<A HREF="HTReader.html">HTReader stream</A>, for example. In the
<A HREF="HTInit.html">default initialization module</A>, you can find the
<CODE>HTTransportInit()</CODE> function which sets up this stream as a default
transport for handling unbuffered socket write operations.
<P>
The difference from the <A HREF="HTWriter.html">unbuffered write stream</A>
is that this stream lets you write characters without causing a
<CODE>write</CODE> system call every time. The data is first written into
a buffer. Data is written to the transport only when the buffer is full,
or when the stream is flushed.
<P>
This module is implemented by <A HREF="HTBufWrt.c">HTBufWrt.c</A>, and it
is a part of the <A HREF="http://www.w3.org/Library/">W3C Sample Code
Library</A>.
<PRE>
#ifndef HTBUFWRT_H
#define HTBUFWRT_H

#include <A HREF="HTIOStream.html">"HTIOStream.h"</A>

#ifdef __cplusplus
extern "C" { 
#endif 
</PRE>
<H2>
  Default Output Buffering
</H2>
<P>
In order to optimize reading a channel, we bind a buffer to each channel
object. The size of this buffer is a compromise between speed and memory.
By default, we have chosen a value frequently used in TCP connections. In
the stream creation method you can pass any other buffer size. In the case
of 0, we take the default size.
<PRE>
#define OUTPUT_BUFFER_SIZE 1024
</PRE>
<H2>
  Buffered Write Stream
</H2>
<PRE>
extern HTOutput_new HTBufferWriter_new;
</PRE>
<H2>
  Buffered Write Converter Stream
</H2>
<PRE>
extern HTOutputConverter_new HTBufferConverter_new;
</PRE>
<PRE>
#ifdef __cplusplus
}
#endif

#endif  /* HTBUFWRT_H */
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTBufWrt.html,v 2.7 2005/11/11 14:03:15 vbancrof Exp $
</ADDRESS>
</BODY></HTML>

Webmaster