Annotation of libwww/Library/src/HTHost.html, revision 2.29

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.14      frystyk     3:   <TITLE>W3C Sample Code Library libwww Host Class</TITLE>
2.1       frystyk     4: </HEAD>
                      5: <BODY>
2.3       frystyk     6: <H1>
                      7:   The Host Class
                      8: </H1>
2.1       frystyk     9: <PRE>
                     10: /*
                     11: **     (c) COPYRIGHT MIT 1995.
                     12: **     Please first read the full copyright statement in the file COPYRIGH.
                     13: */
                     14: </PRE>
2.3       frystyk    15: <P>
                     16: The Host class manages what we know about a remote host. This can for example
                     17: be what type of host it is, and what version it is using. Notice that a host
                     18: object can be used to describe both a server or a client - all information
                     19: in the Host object can be shared regardless of whether it is to be used in
                     20: a server application or a client application.
                     21: <P>
                     22: This module is implemented by <A HREF="HTHost.c">HTHost.c</A>, and it is
2.21      frystyk    23: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.3       frystyk    24: Library</A>.
2.1       frystyk    25: <PRE>
                     26: #ifndef HTHOST_H
                     27: #define HTHOST_H
                     28: 
                     29: typedef struct _HTHost HTHost;
2.26      frystyk    30: #define HOST_HASH_SIZE         HT_M_HASH_SIZE
2.1       frystyk    31: 
                     32: #include "HTChannl.h"
                     33: #include "HTReq.h"
2.2       frystyk    34: #include "HTEvent.h"
2.8       frystyk    35: #include "HTProt.h"
2.15      frystyk    36: #include "HTTimer.h"
2.1       frystyk    37: </PRE>
2.3       frystyk    38: <P>
                     39: The Host class contains information about the remote host, for example the
                     40: type (HTTP/1.0, HTTP/1.1, FTP etc.) along with information on how the connections
                     41: can be used (if it supports persistent connections, interleaved access etc.)
                     42: <H2>
2.24      frystyk    43:   <A NAME="Creation">Creation and Deletion Methods</A>
2.3       frystyk    44: </H2>
                     45: <P>
                     46: We keep a cache of information that we know about a remote host. This allows
2.5       frystyk    47: us to be much more detailed in generating requests. Search the host info
                     48: cache for a host object or create a new one and add it. Examples of host
                     49: names are
2.1       frystyk    50: <UL>
2.3       frystyk    51:   <LI>
                     52:     www.w3.org
                     53:   <LI>
                     54:     www.foo.com:8000
2.1       frystyk    55: </UL>
2.3       frystyk    56: <H3>
                     57:   Add a Host Object
                     58: </H3>
2.1       frystyk    59: <PRE>
2.10      eric       60: extern HTHost * HTHost_new (char * host, u_short u_port);
                     61: extern HTHost * HTHost_newWParse(HTRequest * request, char * url, u_short u_port);
2.8       frystyk    62: extern int HTHost_hash (HTHost * host);
2.1       frystyk    63: </PRE>
2.3       frystyk    64: <H3>
                     65:   Delete a Host Object
                     66: </H3>
                     67: <P>
                     68: The Host Class contains an automatic garbage collection of Host objects so
                     69: that we don't keep information around that is stale.
2.6       frystyk    70: <H3>
                     71:   Find a Host Object
                     72: </H3>
                     73: <P>
                     74: Searches the cache of known hosts to see if we already have information about
                     75: this host. If not then we return NULL.
2.24      frystyk    76: <PRE>
                     77: extern HTHost * HTHost_find (char * host);
                     78: </PRE>
                     79: <H3>
2.28      frystyk    80:   Delete the Host table
                     81: </H3>
                     82: <P>
                     83: Cleanup and delete the host table.
                     84: <PRE>
                     85: extern void HTHost_deleteAll (void);
                     86: </PRE>
                     87: <H3>
2.24      frystyk    88:   Is Host Idle?
                     89: </H3>
                     90: <P>
                     91: You can use this function to see whether a host object is idle or in use.
                     92: We have several modes describing how and when a host is idle. This is a function
                     93: of the <A HREF="HTTrans.html">Transport Object</A>
                     94: <PRE>
                     95: extern BOOL HTHost_isIdle (HTHost * host);
2.6       frystyk    96: </PRE>
2.3       frystyk    97: <H2>
2.24      frystyk    98:   <A NAME="Remote">Remote Host Information</A>
2.3       frystyk    99: </H2>
                    100: <P>
2.12      frystyk   101: We keep track of the capabilities of the host in the other end so thatwe
                    102: may adjust our queries to fit it better
2.3       frystyk   103: <H3>
2.5       frystyk   104:   Remote Host Name
                    105: </H3>
                    106: <P>
                    107: Get the name of the remote host. This is set automatically when a new Host
                    108: object and can be asked for at any point in time. You can not change the
                    109: host name but must create a new Host object instead.
                    110: <PRE>
                    111: extern char * HTHost_name      (HTHost * host);
                    112: </PRE>
                    113: <H3>
                    114:   Remote Host Protocol Class and Version
2.3       frystyk   115: </H3>
                    116: <P>
                    117: Define the <EM>host class</EM> of the host at the other end. A class is a
                    118: generic description of the protocol which is exactly like the access method
                    119: in a URL, for example "http" etc. The <EM>host version</EM> is a finer
                    120: distinction (sub-class) between various versions of the host class, for example
                    121: HTTP/0.9, HTTP/1.1 etc. The host version is a bit flag that the protocol
                    122: module can define on its own. That way we don't have to change this module
                    123: when registering a new protocol module. The <EM>host type</EM> is a description
                    124: of whether we can keep the connection persistent or not.
2.1       frystyk   125: <PRE>
                    126: extern char * HTHost_class     (HTHost * host);
                    127: extern void HTHost_setClass    (HTHost * host, char * s_class);
                    128: 
                    129: extern int  HTHost_version     (HTHost * host);
                    130: extern void HTHost_setVersion  (HTHost * host, int version);
                    131: </PRE>
2.3       frystyk   132: <H3>
2.12      frystyk   133:   Public Methods accessible on This Host
2.4       frystyk   134: </H3>
                    135: <P>
                    136: A server can inform a client about the supported methods using the
                    137: <CODE>Public</CODE> header.
                    138: <PRE>extern HTMethod HTHost_publicMethods      (HTHost * me);
                    139: extern void HTHost_setPublicMethods    (HTHost * me, HTMethod methodset);
                    140: extern void HTHost_appendPublicMethods (HTHost * me, HTMethod methodset);
                    141: </PRE>
2.12      frystyk   142: <H3>
2.4       frystyk   143:   Server Name of Remote Host
2.12      frystyk   144: </H3>
2.4       frystyk   145: <P>
                    146: A server can send its server application name and version in a HTTP response.
                    147: We pick up this information and add it to the Host object
                    148: <PRE>extern char * HTHost_server       (HTHost * host);
                    149: extern BOOL HTHost_setServer   (HTHost * host, const char * server);
                    150: </PRE>
2.12      frystyk   151: <H3>
2.4       frystyk   152:   User Agent Name of Remote Host
2.12      frystyk   153: </H3>
2.4       frystyk   154: <P>
                    155: A client can send the name of the client application in a HTTP request. We
2.5       frystyk   156: pick up this information and add it to the Host Object
2.4       frystyk   157: <PRE>extern char * HTHost_userAgent    (HTHost * host);
                    158: extern BOOL HTHost_setUserAgent        (HTHost * host, const char * userAgent);
                    159: </PRE>
2.12      frystyk   160: <H3>
2.7       frystyk   161:   Range Units Accepted by this Host
2.12      frystyk   162: </H3>
2.7       frystyk   163: <P>
                    164: Since all HTTP entities are represented in HTTP messages as sequences of
                    165: bytes, the concept of a byte range is meaningful for any HTTP entity. (However,
                    166: not all clients and servers need to support byte-range operations.) Byte
                    167: range specifications in HTTP apply to the sequence of bytes in the entity-body
                    168: (not necessarily the same as the message-body). A byte range operation may
                    169: specify a single range of bytes, or a set of ranges within a single entity.
                    170: <P>
                    171: You can also check whether a specific range unit is OK. We always say
                    172: <CODE>YES</CODE> except if we have a specific statement from the server that
                    173: it doesn't understand byte ranges - that is - it has sent "none" in a
                    174: "Accept-Range" response header
                    175: <PRE>
                    176: extern char * HTHost_rangeUnits  (HTHost * host);
                    177: extern BOOL HTHost_setRangeUnits (HTHost * host, const char * units);
                    178: extern BOOL HTHost_isRangeUnitAcceptable (HTHost * host, const char * unit);
                    179: </PRE>
2.18      frystyk   180: <H3>
2.23      frystyk   181:   User Defined Contexts
2.18      frystyk   182: </H3>
2.23      frystyk   183: <P>
                    184: This can be used for anything that the application would like to keep tabs
                    185: on.
2.18      frystyk   186: <PRE>
                    187: extern void HTHost_setContext (HTHost * me, void * context);
                    188: extern void * HTHost_context  (HTHost * me);
                    189: </PRE>
2.12      frystyk   190: <H2>
2.24      frystyk   191:   Register a Request on a Host Object
2.12      frystyk   192: </H2>
2.3       frystyk   193: <P>
2.24      frystyk   194: Requests are queued in the Host object until we have
                    195: <A HREF="#Pending">resources to start them</A>. The request is in the form
                    196: of a <A HREF="HTNet.html">Net object</A> as we may have multiple socket requests
                    197: per <A HREF="HTReq.html">Request object</A>. This is for example the case
                    198: with <A HREF="WWWFTp.html">FTP</A> which uses two connections.
2.1       frystyk   199: <PRE>
2.24      frystyk   200: extern int  HTHost_addNet    (HTHost * host, HTNet * net);
                    201: extern BOOL HTHost_deleteNet (HTHost * host, HTNet * net, int status);
2.1       frystyk   202: 
2.24      frystyk   203: extern HTList * HTHost_net   (HTHost * host);
                    204: </PRE>
                    205: <H2>
                    206:   Channels
                    207: </H2>
                    208: <P>
                    209: A <A HREF="HTChannl.html">Channel object</A> is an abstraction for a transport,
                    210: like a TCP connection, for example. Each host object can have at most one
                    211: channel object associated with it.
                    212: <H3>
                    213:   Create a Channel to a Host
                    214: </H3>
                    215: <P>
                    216: As a <A HREF="HTNet.html">Net Object</A> doesn't necessarily know whether
                    217: there is a channel up and running and whether that channel can be reused,
                    218: it must do an explicit connect the the host.
                    219: <PRE>
2.29    ! frystyk   220: extern int HTHost_connect (HTHost * host, HTNet * net, char * url);
2.25      frystyk   221: 
2.29    ! frystyk   222: extern int HTHost_accept  (HTHost * host, HTNet * net, char * url);
        !           223: 
        !           224: extern int HTHost_listen  (HTHost * host, HTNet * net, char * url);
2.1       frystyk   225: </PRE>
2.3       frystyk   226: <H3>
2.24      frystyk   227:   Is Channel About to Close?
2.3       frystyk   228: </H3>
                    229: <P>
2.24      frystyk   230: As soon as we know that a channel is about to close (for example because
                    231: the server sends us a <TT>Connection: close</TT> header field) then we register
                    232: this informtation in the Host object:
2.1       frystyk   233: <PRE>
2.15      frystyk   234: extern BOOL HTHost_setCloseNotification (HTHost * host, BOOL mode);
                    235: extern BOOL HTHost_closeNotification (HTHost * host);
2.1       frystyk   236: </PRE>
2.3       frystyk   237: <H3>
2.24      frystyk   238:   Find Channel Associated with a Host Object
2.3       frystyk   239: </H3>
                    240: <P>
2.24      frystyk   241: Here you can find an already associated channel with a host object or you
                    242: can explicitly associate a channel with a host object.
2.1       frystyk   243: <PRE>
2.24      frystyk   244: extern BOOL HTHost_setChannel (HTHost * host, HTChannel * channel);
                    245: extern HTChannel * HTHost_channel (HTHost * host);
2.1       frystyk   246: </PRE>
2.24      frystyk   247: <H3>
                    248:   Delete a Channel
                    249: </H3>
2.3       frystyk   250: <P>
2.24      frystyk   251: When a channel is deleted, it must be unregistered from the host object which
                    252: is done by this operation:
2.1       frystyk   253: <PRE>
2.24      frystyk   254: extern BOOL HTHost_clearChannel (HTHost * host, int status);
2.1       frystyk   255: </PRE>
2.5       frystyk   256: <H2>
2.24      frystyk   257:   <A NAME="Transport">Transport Mode</A>
2.12      frystyk   258: </H2>
                    259: <P>
2.24      frystyk   260: The way a channel can be used depends on the
                    261: <A HREF="HTTrans.html">transport</A> and what mode the channel is in. The
                    262: mode (whether we can use persistent connections, pipeline, etc.) may change
                    263: mode in the middle of a connection If the new mode is lower than the old
                    264: mode then adjust the pipeline accordingly. That is, if we are going into
                    265: single mode then move all entries in the pipeline and move the rest to the
                    266: pending queue. They will get launched at a later point in time.
                    267: <PRE>
                    268: extern HTTransportMode HTHost_mode (HTHost * host, BOOL * active);
2.12      frystyk   269: extern BOOL HTHost_setMode (HTHost * host, HTTransportMode mode);
                    270: </PRE>
                    271: <H2>
2.24      frystyk   272:   <A NAME="Pending">Handling Pending Requests</A>
2.5       frystyk   273: </H2>
                    274: <P>
2.24      frystyk   275: There are two ways we can end up with pending requests:
2.5       frystyk   276: <OL>
                    277:   <LI>
                    278:     If we are out of sockets then register new host objects as pending.
                    279:   <LI>
                    280:     If we are pending on a connection then register new net objects as pending
                    281: </OL>
                    282: <P>
                    283: This set of functions handles pending host objects and can start new requests
                    284: as resources get available. The first function checks the host object for
                    285: any pending <A HREF="HTNet.html">Net objects</A> and return the first of
                    286: these Net objects.
2.3       frystyk   287: <PRE>
2.5       frystyk   288: extern HTNet * HTHost_nextPendingNet (HTHost * host);
                    289: </PRE>
                    290: <P>
                    291: The second checks the list of pending host objects waiting for a socket and
                    292: returns the first of these Host objects.
                    293: <PRE>
                    294: extern HTHost * HTHost_nextPendingHost (void);
                    295: </PRE>
2.24      frystyk   296: <H3>
                    297:   Start the Next Pending reqeust
                    298: </H3>
2.5       frystyk   299: <P>
                    300: Start the next pending request if any. First we look for pending requests
                    301: for the same host and then we check for any other pending hosts. If nothing
2.24      frystyk   302: pending then register a close event handler to have something catching the
                    303: socket if the remote server closes the connection, for example due to timeout.
2.8       frystyk   304: <PRE>
                    305: extern BOOL HTHost_launchPending (HTHost * host);
                    306: </PRE>
2.22      frystyk   307: <H3>
2.24      frystyk   308:   Stop Launch of Pending Requests
2.22      frystyk   309: </H3>
2.23      frystyk   310: <P>
2.24      frystyk   311: Controls whether pending requests should be automatically activated. The
                    312: default is on, but if turned off then no pending requests are launched.
2.22      frystyk   313: <PRE>
2.24      frystyk   314: extern void HTHost_enable_PendingReqLaunch (void);
                    315: extern void HTHost_disable_PendingReqLaunch (void);
2.22      frystyk   316: </PRE>
2.12      frystyk   317: <H2>
2.24      frystyk   318:   <A NAME="Persistent">Persistent Connections</A>
2.12      frystyk   319: </H2>
2.24      frystyk   320: <P>
                    321: We don't want more than (Max open sockets) - 2 connections to be persistent
                    322: in order to avoid deadlock. You can set the max number of simultaneous open
                    323: connection in the <A HREF="HTNet.html"#Resources>HTNet manager</A>.
                    324: <H3>
                    325:   Is this host Persistent?
                    326: </H3>
2.8       frystyk   327: <PRE>
2.24      frystyk   328: extern BOOL HTHost_setPersistent (HTHost * host, BOOL persistent,
                    329:                                   HTTransportMode mode);
                    330: extern BOOL HTHost_isPersistent (HTHost * host);
2.8       frystyk   331: </PRE>
                    332: <H3>
2.24      frystyk   333:   Persistent Connection Timeouts
2.8       frystyk   334: </H3>
2.12      frystyk   335: <P>
2.24      frystyk   336: If the server doesn't close the connection on us then we close it after a
                    337: while so that we don't unnecessarily take up resources (see also how the
                    338: <A HREF="#RequestTimeout">timeouts of individual requests </A>can be set).
                    339: Libwww provides two mechanisms: an active timeout and a passive timeout.
                    340: The former uses <A HREF="HTTimer.html">libwww timers</A> and is the preferred
                    341: mechanism, the latter passively looks at the Host object when a new request
                    342: is issued in order to determine whether the existing channel can be reused.
                    343: This is primariliy for non-preemptive requests which in general is deprecated.
                    344: <P>
                    345: By default we have an active timeout of 60 secs and a passive timeout of
                    346: 120 secs (the latter is longer as this is less reliable). Active timeout
                    347: s can be accessed using these functions:
2.8       frystyk   348: <PRE>
2.24      frystyk   349: extern BOOL HTHost_setActiveTimeout (ms_t timeout);
                    350: extern ms_t HTHost_activeTimeout (void);
2.8       frystyk   351: </PRE>
2.12      frystyk   352: <P>
2.24      frystyk   353: and passive timeouts can be accessed using these functions
2.8       frystyk   354: <PRE>
2.24      frystyk   355: extern time_t HTHost_persistTimeout (void);
                    356: extern BOOL HTHost_setPersistTimeout (time_t timeout);
2.8       frystyk   357: </PRE>
2.12      frystyk   358: <P>
2.24      frystyk   359: The following two functions are deprecated:
                    360: <PRE>
                    361: extern void HTHost_setPersistExpires (HTHost * host, time_t expires);
                    362: extern time_t HTHost_persistExpires (HTHost * host);
2.12      frystyk   363: </PRE>
2.8       frystyk   364: <H3>
2.24      frystyk   365:   Keeping Track of Number of Reqeusts
2.8       frystyk   366: </H3>
2.12      frystyk   367: <P>
2.24      frystyk   368: Another way to detect when a connection is about to close is to count the
                    369: number of requests made. For example, the (current) default bevaior by most
                    370: Apache servers is to close a TCP connection after 100 requests. I don't quite
                    371: think it makes sense to control the close of a connection like this but anyway,
                    372: there we go.
2.8       frystyk   373: <PRE>
2.24      frystyk   374: extern void HTHost_setReqsPerConnection (HTHost * host, int reqs);
                    375: extern int HTHost_reqsPerConnection (HTHost * host);
                    376: extern void HTHost_setReqsMade (HTHost * host, int reqs);
                    377: extern int HTHost_reqsMade (HTHost * host);
2.8       frystyk   378: </PRE>
2.24      frystyk   379: <H2>
                    380:   <A NAME="R&amp;W">Read and Write Management</A>
                    381: </H2>
                    382: <P>
                    383: Which <A HREF="HTNet.html">Net object</A> can read and/or write? When doing
                    384: pipelining, we essentially serialize requests and therefore we must keep
                    385: track of who can read and who can write.
2.8       frystyk   386: <H3>
2.12      frystyk   387:   Get the Next Net object for Reading and Writing
2.8       frystyk   388: </H3>
                    389: <PRE>
                    390: extern HTNet * HTHost_firstNet     (HTHost * host);
                    391: extern HTNet * HTHost_getReadNet  (HTHost * host);
                    392: extern HTNet * HTHost_getWriteNet (HTHost * host);
                    393: </PRE>
                    394: <H3>
                    395:   Get input and output Streams for this Host
                    396: </H3>
                    397: <PRE>
                    398: extern HTInputStream * HTHost_getInput (HTHost * host, HTTransport * transport,
                    399:                                        void * param, int mode);
                    400: 
                    401: extern HTOutputStream * HTHost_getOutput (HTHost * host, HTTransport * tp,
                    402:                                          void * param, int mode);
                    403: </PRE>
                    404: <H3>
2.24      frystyk   405:   Reading Data and Keeping Track of how Much
2.8       frystyk   406: </H3>
2.24      frystyk   407: <P>
                    408: Because of the push streams, the streams must keep track of how much data
                    409: actually was consumed by that stream.
2.8       frystyk   410: <PRE>
                    411: extern int HTHost_read(HTHost * host, HTNet * net);
2.24      frystyk   412: 
2.8       frystyk   413: extern BOOL HTHost_setConsumed(HTHost * host, size_t bytes);
2.24      frystyk   414: extern BOOL HTHost_setRemainingRead(HTHost * host, size_t remainaing);
                    415: extern size_t HTHost_remainingRead (HTHost * host);
2.3       frystyk   416: </PRE>
2.12      frystyk   417: <H2>
2.24      frystyk   418:   <A NAME="Pipeline">Pipelining Requests</A>
2.23      frystyk   419: </H2>
                    420: <P>
2.24      frystyk   421: When possible, we try to pipeline requests onto the same connection as this
                    422: saves a lot of time and leads to much higher throughput.
                    423: <H3>
                    424:   How many Requests can we Pipeline onto the same Connection?
                    425: </H3>
                    426: <P>
                    427: Use these functions to set the max number of requests that can be pipelined
                    428: at any one time on a single, persistent connection. The higher the number,
                    429: the more we have to recover if the server closes the connection prematurely.
                    430: The default is about 50 requests which is enough to fill most links.
                    431: <PRE>
                    432: extern BOOL HTHost_setMaxPipelinedRequests (int max);
                    433: extern int HTHost_maxPipelinedRequests (void);
                    434: </PRE>
2.23      frystyk   435: <H3>
2.27      frystyk   436:   How many Pending and Outstanding Net objects are there on a Host?
                    437: </H3>
                    438: <P>
                    439: You can query how many Het objects (essentially requests) are outstanding
                    440: or pending on a host object using these methods:
                    441: <PRE>
                    442: extern int HTHost_numberOfOutstandingNetObjects (HTHost * host);
                    443: extern int HTHost_numberOfPendingNetObjects (HTHost * host);
                    444: </PRE>
                    445: <H3>
2.23      frystyk   446:   Pipeline Recovery
                    447: </H3>
                    448: <P>
2.24      frystyk   449: Pipelines normally run by themselves (requests are issued and responses
                    450: recieved). However, it may be necessry to either prematurely abort a pipeline
                    451: or to recover a broken pipeline due to communication problems with the server.
2.23      frystyk   452: In case a pipeline is broken then we have to recover it and start again.
                    453: This is handled automatically by the host object, so you do not have to call
                    454: this one explicitly.
                    455: <PRE>
                    456: extern BOOL HTHost_recoverPipe (HTHost * host);
                    457: extern BOOL HTHost_doRecover (HTHost * host);
                    458: </PRE>
                    459: <H3>
                    460:   Kill a Pipeline
                    461: </H3>
                    462: <P>
                    463: Call this function to terminate all requests (pending as well as active)
                    464: registered with a host object. This is typically the function that handles
                    465: timeout, abort (user hits the red button, etc). You can also use the
                    466: <A HREF="HTNet.html">HTNet object kill method</A> which in terms call this
                    467: function.
                    468: <PRE>extern BOOL HTHost_killPipe (HTHost * host);
                    469: </PRE>
                    470: <H2>
2.24      frystyk   471:   <A NAME="Event">Event Management</A>
                    472: </H2>
                    473: <P>
                    474: These functions are used to register and unregister events (read, write,
                    475: etc.) so that the host object knows about it.
                    476: <PRE>
                    477: extern int HTHost_register(HTHost * host, HTNet * net, HTEventType type);
                    478: extern int HTHost_unregister(HTHost * host, HTNet * net, HTEventType type);
                    479: extern int HTHost_tickleFirstNet(HTHost * host, HTEventType type);
                    480: 
                    481: extern SockA * HTHost_getSockAddr(HTHost * host);
                    482: </PRE>
                    483: <H3>
                    484:   <A NAME="RequestTimeout">Request Timeouts</A>
                    485: </H3>
                    486: <P>
                    487: Events can be assigned a timeout which causes the event to be triggered if
                    488: the timeout happens before other action is available on the socket. You can
                    489: assign a global timeout for all host object using the following methods.
                    490: The default is no timeout.
                    491: <PRE>
                    492: extern int HTHost_eventTimeout (void);
                    493: extern void HTHost_setEventTimeout (int millis);
                    494: </PRE>
                    495: <H2>
                    496:   <A NAME="Delayed">Delayed Flush Timer</A>
                    497: </H2>
                    498: <P>
                    499: These methods can control how long we want to wait for a flush on a pipelined
                    500: channel. The default is 30ms which is OK in most situations.
                    501: <PRE>
                    502: extern BOOL HTHost_setWriteDelay (HTHost * host, ms_t delay);
                    503: extern ms_t HTHost_writeDelay (HTHost * host);
                    504: extern int HTHost_findWriteDelay(HTHost * host, ms_t lastFlushTime, int buffSize);
                    505: </PRE>
                    506: <P>
                    507: It is also possible to explicitly require a flush using the following method.
                    508: This can also be set directly in the <A HREF="HTReq.html">request object</A>
                    509: for a single request.
                    510: <PRE>
                    511: extern int HTHost_forceFlush(HTHost * host);
                    512: </PRE>
                    513: <P>
                    514: You can also set the <EM>global</EM> value so that all new host objects (and
                    515: therefore all new requests) will inherit this value instead of setting it
                    516: individually.
                    517: <PRE>extern BOOL HTHost_setDefaultWriteDelay (ms_t delay);
                    518: extern ms_t HTHost_defaultWriteDelay (void);
                    519: </PRE>
                    520: <H2>
2.12      frystyk   521:   Multi homed Host Management
                    522: </H2>
                    523: <P>
2.24      frystyk   524: We keep track of hosts with multiple IP addresses - socalled <I>multi-homed
                    525: hosts</I>. This is used for two things: finding the fastest IP address of
                    526: that host and as a backup if one or more of the hosts are down. This is handled
                    527: in connection with the <A HREF="HTDNS.html">DNS manager</A>
2.1       frystyk   528: <PRE>
2.12      frystyk   529: extern BOOL HTHost_setHome (HTHost * host, int home);
                    530: extern int HTHost_home (HTHost * host);
2.13      frystyk   531: 
                    532: extern BOOL HTHost_setRetry (HTHost * host, int retry);
                    533: extern int HTHost_retry (HTHost * host);
                    534: extern BOOL HTHost_decreaseRetry (HTHost * host);
2.19      kahan     535: </PRE>
2.23      frystyk   536: <H2>
                    537:   Notify Request that it has become Active
                    538: </H2>
2.19      kahan     539: <P>
2.24      frystyk   540: A new callback plugged to the activation of a request which allows an application
                    541: to know when a request has become active.
2.19      kahan     542: <PRE>
2.24      frystyk   543: typedef int HTHost_ActivateRequestCallback (HTRequest * request);
                    544: extern void HTHost_setActivateRequestCallback
                    545:                (HTHost_ActivateRequestCallback * cbf);
2.19      kahan     546: </PRE>
                    547: <P>
2.12      frystyk   548: <PRE>
2.1       frystyk   549: #endif /* HTHOST_H */
                    550: </PRE>
2.3       frystyk   551: <P>
                    552:   <HR>
2.1       frystyk   553: <ADDRESS>
2.29    ! frystyk   554:   @(#) $Id: HTHost.html,v 2.28 1999/03/31 19:48:21 frystyk Exp $
2.1       frystyk   555: </ADDRESS>
2.3       frystyk   556: </BODY></HTML>

Webmaster