File:  [Public] / libwww / Library / src / HTBufWrt.html
Revision 2.4: download - view: text, annotated - select for diffs
Sun Feb 16 18:42:02 1997 UTC (27 years, 3 months ago) by frystyk
Branches: MAIN
CVS tags: Release-5-1l, Release-5-1k, Release-5-1j, Release-5-1g, Release-5-1e, Release-5-1d, Release-5-1b, Release-5-1a, Release-5-1, HEAD
Changed name of sample coed library

<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/pub/WWW/Library/">W3C Sample Code
Library</A>.
<PRE>
#ifndef HTBUFWRT_H
#define HTBUFWRT_H

#include <A HREF="HTIOStream.html">"HTIOStream.h"</A>
</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>
<PRE>
#endif
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTBufWrt.html,v 2.4 1997/02/16 18:42:02 frystyk Exp $
</ADDRESS>
</BODY></HTML>

Webmaster