Generic Network Communication

/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
This module has the common code for handling TCP/IP and DECnet connections etc. The main topics of functions in this module are: This module is implemented by HTTCP.c, and it is a part of the W3C Reference Library.
#ifndef HTTCP_H
#define HTTCP_H
#include "HTReq.h"
#include "HTNet.h"

Connection Management

All connections are established through the following functions.

Active Connection Establishment

This makes an active connect to the specified host. The HTNet structure is parsed in order to handle errors. Default port might be overwritten by any port indication in the URL specified as <host>:<port> If it is a multihomed host then HTDoConnect measures the time to do the connection and updates the calculated weights in the cache of visited hosts.
extern int HTDoConnect (HTNet * net, char * url, u_short default_port);

Passive Connection Establishment

This function makes a non-blocking accept on a port. The net must contain a valid socket to accept on. If accept is OK then the socket descripter in the Net object is swapped to the new one.
extern int HTDoAccept (HTNet * net);

Listen on a Socket

Listens on the specified port. 0 means that we don't care and a temporary one will be assigned. If master==INVSOC then we listen on all local interfaces (using a wildcard). If !INVSOC then use this as the local interface. backlog is the number of connections that can be queued on the socket - you can use HT_BACKLOG for a platform dependent value (typically 5 on BSD and 32 on SVR4). Returns HT_ERROR or HT_OK.
extern int HTDoListen (HTNet * net, u_short port, SOCKET master, int backlog);
#endif   /* HTTCP_H */

@(#) $Id: HTTCP.html,v 2.38 1996/04/12 17:49:02 frystyk Exp $