Annotation of libwww/Library/src/HTSocket.html, revision 2.14

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.4       frystyk     3: <TITLE>Socket I/O Manager</TITLE>
2.14    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  9-Dec-1995 -->
2.1       frystyk     5: <NEXTID N="z18">
                      6: </HEAD>
                      7: <BODY>
                      8: 
                      9: <H1>Manages Read and Write to and from the Network</H1>
                     10: 
                     11: <PRE>
                     12: /*
                     13: **     (c) COPYRIGHT MIT 1995.
                     14: **     Please first read the full copyright statement in the file COPYRIGH.
                     15: */
                     16: </PRE>
                     17: 
                     18: This module defines the read and write functions to and from the
                     19: network. As we are having reentrant function and a smarter network I/O
                     20: this will get very small :-) <P>
                     21: 
                     22: This module is implemented by <A HREF="HTSocket.c">HTSocket.c</A>, and
2.9       frystyk    23: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     24: Reference Library</A>.
2.1       frystyk    25: 
                     26: <PRE>
                     27: #ifndef HTSOCKET_H
                     28: #define HTSOCKET_H
                     29: 
2.6       frystyk    30: #include <A HREF="tcp.html">"tcp.h"</A>
                     31: #include <A HREF="HTReq.html">"HTReq.h"</A>
2.1       frystyk    32: #include <A HREF="HTStream.html">"HTStream.h"</A>
                     33: #include <A HREF="HTAnchor.html">"HTAnchor.h"</A>
2.13      frystyk    34: #include <A HREF="HTEvntrg.html">"HTEvntrg.h"</A>
2.1       frystyk    35: </PRE>
                     36: 
                     37: <H2>Create an Input Buffer</H2>
                     38: 
                     39: This function allocates a input buffer and binds it to the socket
2.6       frystyk    40: descriptor given as parameter. The size of the buffer,
2.9       frystyk    41: <CODE>INPUT_BUFFER_SIZE</CODE>, is a compromise between speed and
2.7       frystyk    42: memory. Here it is chosen as the default TCP High Water Mark
                     43: (sb_hiwat) for receiving data.
2.1       frystyk    44: 
                     45: <PRE>
2.6       frystyk    46: 
                     47: #define INPUT_BUFFER_SIZE 8192
                     48: 
                     49: typedef struct _HTInputSocket HTInputSocket;
                     50: 
2.12      frystyk    51: extern HTInputSocket* HTInputSocket_new (SOCKET file_number);
2.1       frystyk    52: </PRE>
                     53: 
                     54: <H2>Free an Input Buffer</H2>
                     55: 
                     56: <PRE>
2.9       frystyk    57: extern void HTInputSocket_free (HTInputSocket * isoc);
2.1       frystyk    58: </PRE>
                     59: 
2.12      frystyk    60: <H2>Load Data from a Socket</H2>
                     61: 
                     62: This function is a wrapper around the <CODE>HTSocketRead()</CODE>
                     63: declared below. It provides a callback function for the <A
2.13      frystyk    64: HREF="HTEvntrg.html">event loop</A> so that a socket can be loaded
2.12      frystyk    65: using non-blocking I/O. The function requires an <B>open</B>
                     66: socket. It will typically be used in server applications or in a
                     67: client application that can read directly from <CODE>stdin</CODE>.
                     68: 
                     69: <PRE>
                     70: extern HTEventCallback HTLoadSocket;
                     71: </PRE>
                     72: 
2.1       frystyk    73: <A NAME="Read"><H2>Read Data from a Socket</H2></A>
                     74: 
                     75: This function has replaced many other functions for doing read from a
2.9       frystyk    76: socket. It automatically converts from ASCII if we are on a NON-ASCII
2.1       frystyk    77: machine. This assumes that we do <B>not</B> use this function to read
                     78: a local file on a NON-ASCII machine. The following type definition is
                     79: to make life easier when having a state machine looking for a
                     80: <CODE>&lt;CRLF&gt;</CODE> sequence.
                     81: 
                     82: <PRE>
                     83: typedef enum _HTSocketEOL {
                     84:     EOL_ERR = -1,
                     85:     EOL_BEGIN = 0,
                     86:     EOL_FCR,
                     87:     EOL_FLF,
                     88:     EOL_DOT,
                     89:     EOL_SCR,
                     90:     EOL_SLF
                     91: } HTSocketEOL;
                     92: 
2.14    ! frystyk    93: extern FILE * HTSocket_DLLHackFopen (const char * filename, const char * mode);
2.8       frystyk    94: extern int HTSocketRead        (HTRequest * request, HTNet * net);
2.1       frystyk    95: </PRE>
                     96: 
2.2       frystyk    97: <H2>Read from an ANSI file Descriptor</H2>
                     98: 
                     99: This function has replaced the HTParseFile() and HTFileCopy functions
                    100: for read from an ANSI file descriptor.
                    101: 
                    102: <PRE>
2.8       frystyk   103: extern int HTFileRead  (HTRequest * request, HTNet * net, FILE * fp);
2.9       frystyk   104: </PRE>
2.1       frystyk   105: 
2.9       frystyk   106: <PRE>
2.1       frystyk   107: #endif
                    108: </PRE>
                    109: 
2.9       frystyk   110: End of declaration module
2.1       frystyk   111: 
                    112: </BODY>
                    113: </HTML>

Webmaster