亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? httcp.c

?? firtext搜索引擎源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*									HTTCP.c**	TCP SPECIFIC CODE****	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.**	@(#) $Id: HTTCP.c,v 2.119 2000/08/02 10:48:12 kahan Exp $****	This code is in common between client and server sides.****	16 Jan 92  TBL	Fix strtol() undefined on CMU Mach.**	25 Jun 92  JFG  Added DECNET option through TCP socket emulation.**	13 Sep 93  MD   Added correct return of vmserrorno for HTInetStatus.**			Added decoding of vms error message for MULTINET.**	31 May 94  HF	Added cache on host id's; now use inet_ntoa() to**			HTInetString and some other fixes. Added HTDoConnect**			and HTDoAccept*//* Library include files */#include "wwwsys.h"#include "WWWUtil.h"#include "WWWCore.h"#include "HTReqMan.h"#include "HTNetMan.h"#include "HTTCP.h"					 /* Implemented here */#include "HTHstMan.h"/* VMS stuff */#ifdef VMS#ifndef MULTINET#define FD_SETSIZE 32#else /* Multinet */#define FD_SETSIZE 256#endif /* Multinet */#endif /* VMS *//* Macros and other defines *//* x ms penalty on a multi-homed host if IP-address is unreachable */#define TCP_DELAY		30000/* x ms penalty on a multi-homed host if IP-address is down for unknown reason */#define TCP_PENALTY		60000/* empirical study in socket call error codes   yovavm@contact.com : added handling for WSAEINVAL error code (Windows)   "When calling connect() in the second time, after the first call to    connect() returned WSAEWOULDBLOCK, an error of WSAEINVAL is returned.    It happens often on WinNT & Win95, and rarely on Win2K & Win98, where in    most cases the second call to connect() returns WSAEISCON (10056).   jose@w3.org : didn't add that test for Unix, as the connect() doc (Linux   and Solaris) says it's not needed. */#ifdef _WINSOCKAPI_					/* windows */#define NETCALL_ERROR(ret)	(ret == SOCKET_ERROR)#define NETCALL_DEADSOCKET(err)	(err == WSAEBADF)#define NETCALL_WOULDBLOCK(err)	(err == WSAEWOULDBLOCK)#define NETCALL_INVAL(err)      (err == WSAEINVAL)#else /* _WINSOCKAPI_ 					   unix    */#define NETCALL_ERROR(ret)	(ret < 0)#define NETCALL_DEADSOCKET(err)	(err == EBADF)#if defined(EAGAIN) && defined(EALREADY)#define NETCALL_WOULDBLOCK(err)	(err == EINPROGRESS || \				 err == EALREADY || \				 err == EAGAIN)#else /* (EAGAIN && EALREADY) */#ifdef EALREADY#define NETCALL_WOULDBLOCK(err)	(err == EINPROGRESS || err == EALREADY)#else /* EALREADY */#ifdef EAGAIN#define NETCALL_WOULDBLOCK(err)	(err == EINPROGRESS || err == EAGAIN)#else /* EAGAIN */#define NETCALL_WOULDBLOCK(err)	(err == EINPROGRESS)#endif /* !EAGAIN */#endif /* !EALREADY */#endif /* !(EAGAIN && EALREADY) */#endif /* !_WINSOCKAPI_ 				   done */#if defined(__svr4__) || defined (_WINSOCKAPI_)#define HT_HOSTUNREACHABLE(e)	((e)==ECONNREFUSED || (e)==ETIMEDOUT || \				 (e)==ENETUNREACH || (e)==EHOSTUNREACH || \				 (e)==EHOSTDOWN)#else#define HT_HOSTUNREACHABLE(e)	((e)==ECONNREFUSED || (e)==ETIMEDOUT || \				 (e)==ENETUNREACH || (e)==EHOSTUNREACH || \				 (e)==EHOSTDOWN || (e)==EINVAL)#endif/* ------------------------------------------------------------------------- *//*	       	      CONNECTION ESTABLISHMENT MANAGEMENT 		     *//* ------------------------------------------------------------------------- *//* _makeSocket - create a socket, if !preemptive, set FIONBIO** returns sockfd or INVSOC if error*/PRIVATE int _makeSocket (HTHost * host, HTRequest * request, int preemptive){    int status = 1;    SOCKET sockfd = INVSOC;#ifdef DECNET    if ((sockfd=socket(AF_DECnet, SOCK_STREAM, 0))==INVSOC)#else    if ((sockfd=socket(AF_INET, SOCK_STREAM,IPPROTO_TCP))==INVSOC)#endif    {	HTRequest_addSystemError(request, ERR_FATAL, socerrno, NO, "socket");	return INVSOC;    }    HTTRACE(PROT_TRACE, "Socket...... Created %d\n" _ sockfd);    /* Increase the number of sockets by one */    HTNet_increaseSocket();    /*    **  If we have compiled without Nagle's algorithm then try and turn    **  it off now    */#if defined(HT_NO_NAGLE) && defined(HAVE_SETSOCKOPT) && defined(TCP_NODELAY)    {	int disable = 1;	status = setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,			    (char *) &disable, sizeof(int));	if (status == -1) {	    HTTRACE(PROT_TRACE, "Socket...... Could not disable Nagle's algorithm - error %d\n" _ 			sockfd);	} else {	    HTTRACE(PROT_TRACE, "Socket...... Turned off Nagle's algorithm\n");	}    }#endif    /* If non-blocking protocol then change socket status    ** I use fcntl() so that I can ask the status before I set it.    ** See W. Richard Stevens (Advan. Prog. in UNIX environment, p.364)    ** Be CAREFULL with the old `O_NDELAY' - it will not work as read()    ** returns 0 when blocking and NOT -1. FNDELAY is ONLY for BSD and    ** does NOT work on SVR4 systems. O_NONBLOCK is POSIX.    */    if (!preemptive) {#ifdef _WINSOCKAPI_	{		/* begin windows scope  */	    long levents = FD_READ | FD_WRITE | FD_ACCEPT | 			   FD_CONNECT | FD_CLOSE ;	    int rv = 0 ;	    u_long one = 1;	    status = ioctlsocket(sockfd, FIONBIO, &one) == 		     SOCKET_ERROR ? -1 : 0;	} /* end scope */#else /* _WINSOCKAPI_ */#if defined(VMS)	{	    int enable = 1;	    status = IOCTL(sockfd, FIONBIO, &enable);	}#else /* VMS */	if((status = fcntl(sockfd, F_GETFL, 0)) != -1) {#ifdef O_NONBLOCK	    status |= O_NONBLOCK;			    /* POSIX */#else /* O_NONBLOCK */#ifdef F_NDELAY		    status |= F_NDELAY;				      /* BSD */#endif /* F_NDELAY */#endif /* !O_NONBLOCK */		    status = fcntl(sockfd, F_SETFL, status);	}#endif /* !VMS */#endif /* !_WINSOCKAPI_ */	HTTRACE(PROT_TRACE, "Socket...... %slocking socket\n" _ status == -1 ? "B" : "Non-b");    } else	HTTRACE(PROT_TRACE, "Socket...... Blocking socket\n");    return sockfd;}/***  Associate the channel with the host and create an input and and output stream**  for this host/channel*/PRIVATE BOOL createChannelAndTransportStreams (HTHost * host, SOCKET sockfd, HTTransport * trans){    if (host && sockfd!=INVSOC && trans) {	HTHost_setChannel(host, HTChannel_new(sockfd, NULL, YES));	HTHost_getInput(host, trans, NULL, 0);	HTHost_getOutput(host, trans, NULL, 0);	return YES;    }    return NO;}/*								HTDoConnect()****	Note: Any port indication in URL, e.g., as `host:port' overwrites**	the default port value.****	returns		HT_ERROR	Error has occured or interrupted**			HT_OK		if connected**			HT_WOULD_BLOCK  if operation would have blocked*/PUBLIC int HTDoConnect (HTNet * net){    HTHost * host = HTNet_host(net);    HTRequest * request = HTNet_request(net);    char * hostname = HTHost_name(host);    int preemptive = net->preemptive;    int status = HT_OK;    /* Jump into the state machine */    while (1) {	switch (host->tcpstate) {	  case TCP_BEGIN:	  {	      /*	      ** Add the net object to the host object found above. If the	      ** host is idle then we can start the request right away,	      ** otherwise we must wait until it is free. 	      */	      if ((status = HTHost_addNet(host, net)) == HT_PENDING)		  HTTRACE(PROT_TRACE, "HTDoConnect. Pending...\n");	      /*	      ** If we are pending then return here, otherwise go to next state	      ** which is setting up a channel	      */	      host->tcpstate = TCP_CHANNEL;	      HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CHANNEL.\n" _ host);	      if (status == HT_PENDING) return HT_PENDING;	  }	  break;	case TCP_CHANNEL:	    /*	    **  The next state depends on whether we have a connection	    **  or not - if so then we can jump directly to connect() to	    **  test it - otherwise we must around DNS to get the name	    **  Resolved	    */	    if (HTHost_channel(host) == NULL) {		host->tcpstate = TCP_DNS;		HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_DNS.\n" _ host);	    } else {		/*		**  There is now one more using the channel		*/		HTChannel_upSemaphore(host->channel);		/*		**  We are now all set and can jump to connected mode		*/		host->tcpstate = TCP_CONNECTED;		HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CONNECTED.\n" _ host);	    }	    hostname = HTHost_name(host);	    break;	case TCP_DNS:	    if ((status = HTParseInet(host, hostname, request)) < 0) {		HTTRACE(PROT_TRACE, "HTDoConnect. Can't locate `%s\'\n" _ hostname);		HTRequest_addError(request, ERR_FATAL, NO,				   HTERR_NO_REMOTE_HOST,				   (void *) hostname, strlen(hostname),				   "HTDoConnect");		host->tcpstate = TCP_DNS_ERROR;		HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_ERROR.\n" _ host);		break;	    }	    if (!HTHost_retry(host) && status > 1)		/* If multiple homes */		HTHost_setRetry(host, status);	    host->tcpstate = TCP_NEED_SOCKET;	    HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_SOCKET.\n" _ host);	    break;	case TCP_NEED_SOCKET:	{	    SOCKET sockfd;	    /* Create a new socket */	    if ((sockfd = _makeSocket(host, request, preemptive)) == INVSOC) {		host->tcpstate = TCP_ERROR;		break;	    }	    /* Create channnel and streams */	    createChannelAndTransportStreams (host, sockfd, net->transport);	    /* If multi-homed host then start timer on connection */	    if (HTHost_retry(host)) host->connecttime = HTGetTimeInMillis();	    /* Progress notification */	    {		HTAlertCallback *cbf = HTAlert_find(HT_PROG_CONNECT);		if (cbf) (*cbf)(request, HT_PROG_CONNECT, HT_MSG_NULL,				NULL, hostname, NULL);	    }	    host->tcpstate = TCP_NEED_CONNECT;	    HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_CONNECT.\n" _ host);	    break;	}	case TCP_NEED_CONNECT:#ifdef _WINSOCKAPI_	    /* 2000/08/02 Jens Meggers (jens@meggers.com):            ** In HTDoConnect(), the connect command is done before the            ** WSAAsyncSelect() that is called when             ** HTHost_register(host, net, HTEvent_CONNECT); is executed.             ** Although that is in line with the WinSock2 and Microsoft             ** documentation, it does _not_ work all the time. I have done             ** extensive tests on Win2000 and Win 4.0 SP5. In very rare cases,            ** the connect is finished between the connect() command itself and             ** the WSAAsyncSelect(). In this unlikely case, WinSock does not             ** (always) send the FD_CONNECT message. As a result, when using             ** the Async mode, the event loop hangs because there is no             ** timeout procedure registered for FD_CONNECT.	    ** JK: what happens if status returns an error? Do we have to	    ** unregister the HTEvent_CONNECT event then?                                   */	    HTHost_register(host, net, HTEvent_CONNECT);#endif /* _WINSOCKAPI_ */	    status = connect(HTChannel_socket(host->channel), (struct sockaddr *) &host->sock_addr,			     sizeof(host->sock_addr));	    /*	     * According to the Sun man page for connect:	     *     EINPROGRESS         The socket is non-blocking and the  con-	     *                         nection cannot be completed immediately.	     *                         It is possible to select(2) for  comple-	     *                         tion  by  selecting the socket for writ-	     *                         ing.	     * According to the Motorola SVR4 man page for connect:	     *     EAGAIN              The socket is non-blocking and the  con-	     *                         nection cannot be completed immediately.	     *                         It is possible to select for  completion	     *                         by  selecting  the  socket  for writing.	     *                         However, this is only  possible  if  the	     *                         socket  STREAMS  module  is  the topmost	     *                         module on  the  protocol  stack  with  a	     *                         write  service  procedure.  This will be	     *                         the normal case.	     */	    if (NETCALL_ERROR(status))	    {		if (NETCALL_WOULDBLOCK(socerrno))		{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一区二区三区在线观看| 亚洲成人午夜电影| 亚洲综合图片区| 激情伊人五月天久久综合| 99久久久久久| 国产亚洲女人久久久久毛片| 伊人夜夜躁av伊人久久| 国产成人精品亚洲午夜麻豆| 日韩你懂的在线播放| 午夜精品免费在线观看| 日本韩国一区二区三区视频| 久久久精品国产免费观看同学| 日韩精品一区第一页| 91在线视频免费观看| 欧美激情一区在线观看| 久久成人免费电影| 欧美一个色资源| 午夜在线成人av| 在线精品视频免费播放| 亚洲日韩欧美一区二区在线| 国产精品一级片| 久久久久久黄色| 国产精品一品二品| 欧美国产日韩在线观看| 国产精品综合网| www成人在线观看| 精品一区二区在线观看| 欧美xingq一区二区| 美女mm1313爽爽久久久蜜臀| 91精品国产美女浴室洗澡无遮挡| 亚洲va中文字幕| 777欧美精品| 日韩国产精品91| 日韩一区二区免费在线观看| 午夜精品久久久久久久99水蜜桃 | 中文字幕亚洲区| 成人免费视频网站在线观看| 中文字幕一区二区三区四区不卡| 成人永久看片免费视频天堂| 国产精品免费aⅴ片在线观看| 成人在线综合网| 亚洲精品久久久久久国产精华液| 一本到不卡精品视频在线观看| 亚洲视频你懂的| 欧美日韩国产综合视频在线观看| 日韩福利电影在线观看| 日韩欧美资源站| 国产91丝袜在线播放0| 国产精品丝袜一区| 在线精品视频小说1| 天天色天天爱天天射综合| 日韩欧美亚洲一区二区| 精品亚洲成av人在线观看| 国产日韩欧美电影| 一本到不卡免费一区二区| 午夜欧美在线一二页| 精品国产亚洲在线| 国产91在线|亚洲| 亚洲午夜国产一区99re久久| 日韩欧美专区在线| 99久久精品费精品国产一区二区| 亚洲大尺度视频在线观看| 精品美女被调教视频大全网站| 国产91丝袜在线18| 日韩中文字幕av电影| 国产亚洲欧美日韩日本| 欧美性xxxxx极品少妇| 免费视频一区二区| 亚洲日本乱码在线观看| 日韩欧美黄色影院| 色综合天天在线| 蜜桃视频在线观看一区| 亚洲色图欧洲色图| 久久先锋资源网| 欧美日韩一区二区三区免费看 | 欧美一区二区三区免费在线看| 国产一区二区精品久久91| 亚洲一区二区三区四区在线观看 | 国产黄色精品网站| 亚洲国产视频网站| 国产精品久久久久桃色tv| 欧美一区二区三区视频免费| 91香蕉视频黄| 国产毛片精品视频| 日韩成人免费看| 亚洲一区二区视频在线| 国产精品久久99| 久久亚洲私人国产精品va媚药| 欧美日韩中文字幕精品| 成人av网址在线| 国产精品夜夜爽| 麻豆91精品91久久久的内涵| 亚洲成精国产精品女| 最新国产の精品合集bt伙计| 久久精品一区二区三区四区| 日韩精品一区二区三区四区视频| 欧美日韩国产高清一区二区| 91一区二区在线| www.日韩精品| 粉嫩av一区二区三区粉嫩| 国产自产视频一区二区三区| 日日夜夜精品免费视频| 亚洲狠狠爱一区二区三区| 一区二区三区在线观看动漫| 亚洲丝袜美腿综合| 一区二区在线观看免费 | 久久精品视频网| 精品久久久久一区| 欧美va亚洲va| 久久品道一品道久久精品| 欧美大片顶级少妇| 精品人在线二区三区| 日韩精品一区二区三区三区免费| 制服丝袜亚洲色图| 日韩一区二区三区精品视频| 91精品免费观看| 欧美一区二区三区男人的天堂| 欧美一级搡bbbb搡bbbb| 日韩一区二区三区高清免费看看| 欧美电影免费观看高清完整版在线 | 日韩理论电影院| 亚洲免费av在线| 亚洲成av人片一区二区梦乃| 日韩中文欧美在线| 久久99国产精品免费| 国产高清不卡一区| 99久久婷婷国产| 欧美在线免费视屏| 91精品国产综合久久久久久漫画| 欧美一二区视频| 国产欧美一区二区三区沐欲| 中文字幕在线不卡一区| 亚洲制服丝袜在线| 美女视频一区二区三区| 国产999精品久久久久久| 在线视频欧美精品| 日韩亚洲欧美一区| 国产精品乱人伦中文| 亚洲成在人线在线播放| 国产呦精品一区二区三区网站| 盗摄精品av一区二区三区| 色天使色偷偷av一区二区| 欧美一级电影网站| 国产精品视频线看| 依依成人精品视频| 国产精品资源在线| 91高清视频免费看| 精品免费国产二区三区 | 91猫先生在线| 欧美一区二区在线看| 中文字幕成人网| 五月天网站亚洲| 成人av在线资源网| 欧美一区二区三区成人| 国产精品全国免费观看高清 | 91.com在线观看| 国产精品乱码妇女bbbb| 三级亚洲高清视频| 波多野结衣精品在线| 欧美一区二区成人6969| 中文字幕一区日韩精品欧美| 麻豆91免费观看| 欧美亚日韩国产aⅴ精品中极品| 亚洲精品一区二区三区在线观看| 亚洲一区二区精品久久av| 国产呦萝稀缺另类资源| 91精品免费观看| 亚洲精品久久久蜜桃| 高清不卡一区二区在线| 日韩精品资源二区在线| 亚洲va欧美va国产va天堂影院| 成人免费观看av| 久久伊人中文字幕| 视频一区免费在线观看| 一本大道久久精品懂色aⅴ| 久久久久久亚洲综合| 日韩不卡免费视频| 欧美日韩国产在线观看| 亚洲激情成人在线| 99久久精品情趣| 国产亚洲成aⅴ人片在线观看| 毛片av中文字幕一区二区| 91福利视频网站| 亚洲精品国产a| 色94色欧美sute亚洲线路一ni | 久久久www成人免费无遮挡大片| 天堂成人国产精品一区| 欧美在线一区二区| 亚洲精品欧美二区三区中文字幕| 成人午夜看片网址| 国产日韩欧美在线一区| 国产69精品久久久久777| 国产欧美一区在线| 粉嫩av一区二区三区在线播放 | 成人精品小蝌蚪| 国产精品视频观看| 成人黄色a**站在线观看| 国产精品久久精品日日| a美女胸又www黄视频久久| 国产精品久久久久影院亚瑟|