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

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

?? winsock.cxx

?? 開源代碼的pwlib的1.10.0版本,使用openh323的1.18.0版本畢備
?? CXX
?? 第 1 頁 / 共 3 頁
字號:
/*
 * winsock.cxx
 *
 * WINSOCK implementation of Berkley sockets.
 *
 * Portable Windows Library
 *
 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
 *
 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
 * All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: winsock.cxx,v $
 * Revision 1.71.4.1  2006/01/31 08:09:13  csoutheren
 * Backported from CVS head
 *
 * Revision 1.73  2006/01/31 03:38:27  csoutheren
 * Refixed fix for compiler warning
 *
 * Revision 1.72  2006/01/31 03:23:17  csoutheren
 * Fixed compile warning on MSVC 6
 *
 * Revision 1.71  2005/11/30 12:47:42  csoutheren
 * Removed tabs, reformatted some code, and changed tags for Doxygen
 *
 * Revision 1.70  2005/11/21 11:49:36  shorne
 * Changed disableQos to disableGQoS to better reflect what it does
 *
 * Revision 1.69  2005/09/23 15:30:46  dominance
 * more progress to make mingw compile nicely. Thanks goes to Julien Puydt for pointing out to me how to do it properly. ;)
 *
 * Revision 1.68  2005/09/18 13:01:44  dominance
 * fixed pragma warnings when building with gcc.
 *
 * Revision 1.67  2005/08/08 06:59:39  rjongbloed
 * Fixed compiler warning
 *
 * Revision 1.66  2005/07/13 12:08:09  csoutheren
 * Fixed QoS patches to be more consistent with PWLib style and to allow Unix compatibility
 *
 * Revision 1.65  2005/07/13 11:48:55  csoutheren
 * Backported QOS changes from isvo branch
 *
 * Revision 1.64  2004/10/23 10:45:32  ykiryanov
 * Added ifdef _WIN32_WCE for PocketPC 2003 SDK port
 *
 * Revision 1.63  2004/05/06 11:28:30  rjongbloed
 * Changed P_fd_set to use malloc/free isntead of new/delete due to pedantry about [].
 *
 * Revision 1.62  2004/04/27 09:53:27  rjongbloed
 *  Fixed ability to break of a PSocket::Select call under linux when a socket
 *    is closed by another thread.
 *
 * Revision 1.61  2004/04/03 08:22:22  csoutheren
 * Remove pseudo-RTTI and replaced with real RTTI
 *
 * Revision 1.60  2003/11/12 04:40:58  csoutheren
 * Fixed linking problem on systems without QoS or IPV6
 *
 * Revision 1.59  2003/11/10 00:21:38  dereksmithies
 * Stop compiler warnings (unused formal parameters) when P_HAS_QOS is on
 *
 * Revision 1.58  2003/10/30 11:33:59  rjongbloed
 * Added automatic inclusion of Winsock2 library.
 *
 * Revision 1.57  2003/10/28 23:36:22  csoutheren
 * Changed to use ws2_32.lib or wsock32.lib depending on use of QoS
 *
 * Revision 1.56  2003/10/27 08:01:52  csoutheren
 * Removed use of GetAddressByName when using Winsock2
 *
 * Revision 1.55  2003/10/27 03:29:11  csoutheren
 * Added support for QoS
 *    Thanks to Henry Harrison of AliceStreet
 *
 * Revision 1.54  2003/09/17 05:45:10  csoutheren
 * Removed recursive includes
 *
 * Revision 1.53  2002/10/29 08:00:16  robertj
 * Changed in_addr6 to more universally used in6_addr.
 *
 * Revision 1.52  2002/10/19 06:12:20  robertj
 * Moved P_fd_set::Zero() from platform independent to platform dependent
 *   code as Win32 implementation is completely different from Unix.
 *
 * Revision 1.51  2002/10/17 07:17:43  robertj
 * Added ability to increase maximum file handles on a process.
 *
 * Revision 1.50  2002/10/08 12:41:52  robertj
 * Changed for IPv6 support, thanks S閎astien Josset.
 *
 * Revision 1.49  2002/05/23 09:07:41  robertj
 * Further adjustments to compensate for Winsock weirdness on some platforms.
 *
 * Revision 1.48  2002/05/23 01:54:35  robertj
 * Worked around WinSock bug where getsockopt() does not work immediately
 *   after the select() function returns an exception.
 *
 * Revision 1.47  2002/05/22 07:22:17  robertj
 * Fixed bug in waiting for connect with a timeout not checking for errors via
 *   the except fdset in the select() call. Would give timeout for all errors.
 *
 * Revision 1.46  2002/04/12 01:42:41  robertj
 * Changed return value on os_connect() and os_accept() to make sure
 *   get the correct error codes propagated up under unix.
 *
 * Revision 1.45  2001/09/10 02:51:23  robertj
 * Major change to fix problem with error codes being corrupted in a
 *   PChannel when have simultaneous reads and writes in threads.
 *
 * Revision 1.44  2001/09/06 02:30:31  robertj
 * Fixed mismatched declarations, thanks Vjacheslav Andrejev
 *
 * Revision 1.43  2001/03/20 06:57:14  robertj
 * os_accept() function changed due to unix changes re unblocking threads.
 *
 * Revision 1.42  2001/01/24 06:46:45  yurik
 * Windows CE port-related changes
 *
 * Revision 1.41  1998/11/30 04:50:19  robertj
 * New directory structure
 *
 * Revision 1.40  1998/11/14 06:31:15  robertj
 * Changed semantics of os_sendto to return TRUE if ANY bytes are sent.
 *
 * Revision 1.39  1998/09/24 03:31:02  robertj
 * Added open software license.
 *
 * Revision 1.38  1998/08/28 14:09:45  robertj
 * Fixed bug in Write() that caused endlesss loops, introduced in previous version.
 *
 * Revision 1.37  1998/08/21 05:27:31  robertj
 * Fixed bug where write streams out to non-stream socket.
 *
 * Revision 1.36  1998/08/06 00:55:21  robertj
 * Fixed conversion of text to IPX address, was swapping nibbles.
 *
 * Revision 1.35  1998/05/08 11:52:03  robertj
 * Added workaround for winsock bug where getpeername() doesn't work immediately after connect().
 *
 * Revision 1.34  1998/05/07 05:21:04  robertj
 * Fixed DNS lookup so only works around bug in old Win95 and not OSR2
 *
 * Revision 1.33  1998/01/26 01:00:06  robertj
 * Added timeout to os_connect().
 * Fixed problems with NT version of IsLocalHost().
 *
 * Revision 1.32  1997/12/18 05:05:27  robertj
 * Moved IsLocalHost() to platform dependent code.
 *
 * Revision 1.31  1997/12/11 10:41:55  robertj
 * Added DWORD operator for IP addresses.
 *
 * Revision 1.30  1997/01/03 04:37:11  robertj
 * Fixed '95 problem with send timeouts.
 *
 * Revision 1.29  1996/12/05 11:51:50  craigs
 * Fixed Win95 recvfrom timeout problem
 *
 * Revision 1.28  1996/11/10 21:04:56  robertj
 * Fixed bug in not flushing stream on close of socket.
 *
 * Revision 1.27  1996/10/31 12:39:30  robertj
 * Fixed bug in byte order of port numbers in IPX protocol.
 *
 * Revision 1.26  1996/10/26 01:43:18  robertj
 * Removed translation of IP address to host order DWORD. Is ALWAYS net order.
 *
 * Revision 1.25  1996/10/08 13:03:09  robertj
 * More IPX support.
 *
 * Revision 1.24  1996/09/14 13:09:47  robertj
 * Major upgrade:
 *   rearranged sockets to help support IPX.
 *   added indirect channel class and moved all protocols to descend from it,
 *   separating the protocol from the low level byte transport.
 *
 * Revision 1.23  1996/08/08 10:06:07  robertj
 * Fixed incorrect value in write, causes incorrect output if send is split.
 *
 * Revision 1.22  1996/07/27 04:03:29  robertj
 * Created static version of ConvertOSError().
 *
 * Revision 1.21  1996/06/01 04:19:34  robertj
 * Added flush to PSocket destructor as needs to use Write() at that level.
 *
 * Revision 1.20  1996/05/15 10:23:08  robertj
 * Changed millisecond access functions to get 64 bit integer.
 * Added timeout to accept function.
 * Added ICMP protocol socket, getting common ancestor to UDP.
 *
 * Revision 1.19  1996/04/29 12:22:26  robertj
 * Fixed detection of infinite timeout.
 *
 * Revision 1.18  1996/04/17 12:09:52  robertj
 * Fixed bug in detecting infinte timeout.
 *
 * Revision 1.17  1996/04/12 09:45:06  robertj
 * Rewrite of PSocket::Read() to avoid "Connection Reset" errors caused by SO_RCVTIMEO
 *
 * Revision 1.17  1996/04/10 12:15:11  robertj
 * Rewrite of PSocket::Read() to avoid "Connection Reset" errors caused by SO_RCVTIMEO.
 *
 * Revision 1.16  1996/04/05 01:42:28  robertj
 * Assured PSocket::Write always writes the number of bytes specified.
 *
 * Revision 1.15  1996/03/31 09:11:06  robertj
 * Fixed major performance problem in timeout read/write to sockets.
 *
 * Revision 1.14  1996/03/10 13:16:25  robertj
 * Fixed ioctl of closed socket.
 *
 * Revision 1.13  1996/03/04 12:41:02  robertj
 * Fixed bug in leaving socket in non-blocking mode.
 * Changed _Close to os_close to be consistent.
 *
 * Revision 1.12  1996/02/25 11:23:40  robertj
 * Fixed bug in Read for when a timeout occurs on select, not returning error code.
 *
 * Revision 1.11  1996/02/25 03:13:12  robertj
 * Moved some socket functions to platform dependent code.
 *
 * Revision 1.10  1996/02/19 13:52:39  robertj
 * Added SO_LINGER option to socket to stop data loss on close.
 * Fixed error reporting for winsock classes.
 *
 * Revision 1.9  1996/02/15 14:53:36  robertj
 * Added Select() function to PSocket.
 *
 * Revision 1.8  1996/01/23 13:25:48  robertj
 * Moved Accept from platform independent code.
 *
 * Revision 1.7  1996/01/02 12:57:17  robertj
 * Unix compatibility.
 *
 * Revision 1.6  1995/12/10 12:06:00  robertj
 * Numerous fixes for sockets.
 *
 * Revision 1.5  1995/06/17 00:59:49  robertj
 * Fixed bug with stream being flushed on read/write.
 *
 * Revision 1.4  1995/06/04 12:49:51  robertj
 * Fixed bugs in socket read and write function return status.
 * Fixed bug in socket close setting object state to "closed".
 *
 * Revision 1.3  1995/03/12 05:00:10  robertj
 * Re-organisation of DOS/WIN16 and WIN32 platforms to maximise common code.
 * Used built-in equate for WIN32 API (_WIN32).
 *
 * Revision 1.2  1995/01/03  09:43:27  robertj
 * Moved out of band stuff to common.
 *
 * Revision 1.1  1994/10/30  12:06:56  robertj
 * Initial revision
 */

#include <ptlib.h>
#include <ptlib/sockets.h>

#include <nspapi.h>
#include <svcguid.h>

#include <wsipx.h>
#ifdef _MSC_VER
#include <wsnwlink.h>
#else
#define IPX_PTYPE 0x4000
#define NS_DEFAULT 0
#define SVCID_NETWARE(_SapId) {(0x000B << 16)|(_SapId),0,0,{0xC0,0,0,0,0,0,0,0x46}}
#define SVCID_FILE_SERVER SVCID_NETWARE(0x4)
#endif

#if defined(P_WINSOCK2_LIBRARY)
#ifdef _MSC_VER
#pragma comment(lib, P_WINSOCK2_LIBRARY)
#endif
#else
#ifndef _WIN32_WCE
#ifdef _MSC_VER
#pragma comment(lib, "wsock32.lib")
#endif
#endif // !_WIN32_WCE
#endif


//////////////////////////////////////////////////////////////////////////////
// PWinSock

PWinSock::PWinSock()
{
  WSADATA winsock;

#if 0 // old WinSock version check
  PAssert(WSAStartup(0x101, &winsock) == 0, POperatingSystemError);
  PAssert(LOBYTE(winsock.wVersion) == 1 &&
          HIBYTE(winsock.wVersion) == 1, POperatingSystemError);

#endif

  // ensure we support QoS
  PAssert(WSAStartup(0x0202, &winsock) == 0, POperatingSystemError);
  PAssert(LOBYTE(winsock.wVersion) >= 1 &&
          HIBYTE(winsock.wVersion) >= 1, POperatingSystemError);
}


PWinSock::~PWinSock()
{
  WSACleanup();
}


BOOL PWinSock::OpenSocket()
{
  return FALSE;
}


const char * PWinSock::GetProtocolName() const
{
  return NULL;
}


//////////////////////////////////////////////////////////////////////////////
// P_fd_set

void P_fd_set::Construct()
{
  max_fd = UINT_MAX;
  set = (fd_set *)malloc(sizeof(fd_set));
}


void P_fd_set::Zero()
{
  if (PAssertNULL(set) != NULL)
    FD_ZERO(set);
}


//////////////////////////////////////////////////////////////////////////////
// PSocket

PSocket::~PSocket()
{
  Close();
}


BOOL PSocket::Read(void * buf, PINDEX len)
{
  flush();
  lastReadCount = 0;

  if (len == 0)
    return SetErrorValues(BadParameter, EINVAL, LastReadError);

  os_recvfrom((char *)buf, len, 0, NULL, NULL);
  return lastReadCount > 0;
}


BOOL PSocket::Write(const void * buf, PINDEX len)
{
  flush();
  return os_sendto(buf, len, 0, NULL, 0) && lastWriteCount >= len;
}


BOOL PSocket::Close()
{
  if (!IsOpen())
    return FALSE;
  flush();
  return ConvertOSError(os_close());
}


int PSocket::os_close()
{
  int err = closesocket(os_handle);
  os_handle = -1;
  return err;
}


int PSocket::os_socket(int af, int type, int proto)
{
  return ::socket(af, type, proto);
}


BOOL PSocket::os_connect(struct sockaddr * addr, PINDEX size)
{
  if (readTimeout == PMaxTimeInterval)
    return ConvertOSError(::connect(os_handle, addr, size));

  DWORD fionbio = 1;
  if (!ConvertOSError(::ioctlsocket(os_handle, FIONBIO, &fionbio)))
    return FALSE;
  fionbio = 0;

  if (::connect(os_handle, addr, size) != SOCKET_ERROR)
    return ConvertOSError(::ioctlsocket(os_handle, FIONBIO, &fionbio));

  DWORD err = GetLastError();
  if (err != WSAEWOULDBLOCK) {
    ::ioctlsocket(os_handle, FIONBIO, &fionbio);
    SetLastError(err);
    return ConvertOSError(-1);
  }

  P_fd_set writefds = os_handle;
  P_fd_set exceptfds = os_handle;
  P_timeval tv;

  /* To avoid some strange behaviour on various windows platforms, do a zero
     timeout select first to pick up errors. Then do real timeout. */
  int selerr = ::select(1, NULL, writefds, exceptfds, tv);
  if (selerr == 0) {
    writefds = os_handle;
    exceptfds = os_handle;
    tv = readTimeout;
    selerr = ::select(1, NULL, writefds, exceptfds, tv);
  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美韩国一区二区| 天天做天天摸天天爽国产一区| 中文字幕制服丝袜成人av| 亚洲女子a中天字幕| 久久se这里有精品| 欧美性猛交一区二区三区精品| 欧美不卡一区二区三区四区| 亚洲美女视频在线| 国产精品一区二区三区网站| 欧美日韩国产中文| 综合久久一区二区三区| 国产精品一区一区三区| 91精品国产91久久久久久最新毛片| 日韩一区日韩二区| 粉嫩蜜臀av国产精品网站| 日韩欧美一级特黄在线播放| 亚洲国产成人91porn| 91小视频在线观看| 国产精品日日摸夜夜摸av| 麻豆国产一区二区| 欧美高清视频在线高清观看mv色露露十八 | 国产精品无遮挡| 日韩精品免费专区| 欧美日韩国产免费| 亚洲一区免费视频| 一本大道av伊人久久综合| 国产精品视频九色porn| 国产美女久久久久| 国产三级精品视频| 国产不卡一区视频| 国产亚洲精品aa午夜观看| eeuss鲁片一区二区三区在线看| 日韩欧美国产三级| 日韩激情一区二区| 91精品国产美女浴室洗澡无遮挡| 亚洲国产你懂的| 欧美日韩综合在线| 日韩综合一区二区| 欧美一区二区免费| 精品一区二区三区在线观看国产| 欧美大尺度电影在线| 另类成人小视频在线| 久久伊人中文字幕| 国产成人午夜精品5599| 日本一区二区三区国色天香 | 亚洲第一电影网| 91 com成人网| 国产在线视频精品一区| 日本一区二区动态图| 972aa.com艺术欧美| 一区二区欧美在线观看| 欧美日韩不卡一区二区| 久久电影网电视剧免费观看| 26uuu国产在线精品一区二区| 国产精品综合一区二区| 综合婷婷亚洲小说| 欧美巨大另类极品videosbest| 日本色综合中文字幕| 国产日韩影视精品| 欧美又粗又大又爽| 美洲天堂一区二卡三卡四卡视频| 久久久午夜精品| 91理论电影在线观看| 天天av天天翘天天综合网| 久久久久国产精品麻豆ai换脸 | 欧美精品第一页| 狠狠色伊人亚洲综合成人| 国产精品美女久久久久av爽李琼 | 99国产精品久久久久久久久久| 一区二区三区在线免费观看| 欧美一区二视频| 不卡免费追剧大全电视剧网站| 亚洲一区在线观看视频| 久久亚洲捆绑美女| 欧美日韩在线免费视频| 国产一区二区美女| 五月婷婷欧美视频| 国产精品乱码妇女bbbb| 欧美一区二区日韩| 色婷婷精品久久二区二区蜜臂av| 青椒成人免费视频| 亚洲视频一区二区在线观看| 日韩女优av电影| 欧美综合欧美视频| 国产91丝袜在线观看| 亚洲第一成人在线| 亚洲精品欧美专区| 国产亚洲精品超碰| 日韩精品中文字幕在线不卡尤物| 91免费视频网| 国产69精品久久久久毛片| 偷拍一区二区三区四区| 中文字幕色av一区二区三区| 精品日韩在线观看| 56国语精品自产拍在线观看| 91丨九色丨蝌蚪富婆spa| 国产成人在线观看免费网站| 蜜桃在线一区二区三区| 亚洲v精品v日韩v欧美v专区| 国产精品不卡视频| 国产精品情趣视频| 久久只精品国产| 精品国产乱码久久久久久久久 | 久久久高清一区二区三区| 91精品国产综合久久久久久漫画| 色视频成人在线观看免| 成人动漫一区二区| 国产高清精品网站| 国产不卡视频一区二区三区| 国产裸体歌舞团一区二区| 麻豆国产精品官网| 美女精品一区二区| 九一久久久久久| 久久av资源网| 国产福利不卡视频| 国产成人免费在线| 成人午夜av电影| 国产suv精品一区二区883| 国产精品白丝av| 成人免费av资源| 91丨九色porny丨蝌蚪| 99久久综合色| 91久久人澡人人添人人爽欧美| 色婷婷综合久久| 欧美日本在线看| 日韩欧美一二三区| 久久精品亚洲精品国产欧美| 国产欧美精品一区二区色综合朱莉| 欧美激情在线一区二区| 国产精品传媒视频| 亚洲国产日日夜夜| 日本中文一区二区三区| 韩国三级电影一区二区| 懂色av一区二区夜夜嗨| 一本大道久久a久久精二百| 欧美午夜精品理论片a级按摩| 欧美日韩国产综合一区二区三区| 欧美一区二区三区四区五区| 久久久久9999亚洲精品| 亚洲三级免费观看| 日韩精品午夜视频| 国产超碰在线一区| 在线观看视频一区二区| 日韩一卡二卡三卡国产欧美| 久久美女艺术照精彩视频福利播放| 国产精品无遮挡| 午夜欧美电影在线观看| 狠狠v欧美v日韩v亚洲ⅴ| 波多野结衣中文字幕一区二区三区| 91网站最新网址| 精品入口麻豆88视频| 伊人开心综合网| 国产一区啦啦啦在线观看| 91丝袜高跟美女视频| 日韩精品一区二区在线观看| 亚洲日本成人在线观看| 日本中文字幕一区二区有限公司| 国产成人精品免费网站| 欧美性感一类影片在线播放| 精品福利av导航| 亚洲一区免费视频| 国产不卡一区视频| 3atv一区二区三区| 亚洲人成在线播放网站岛国| 热久久国产精品| 91麻豆文化传媒在线观看| 欧美大黄免费观看| 亚洲成人av免费| 成人av在线看| 久久综合九色综合欧美98| 亚洲一区视频在线| 91玉足脚交白嫩脚丫在线播放| 欧美成人r级一区二区三区| 一区二区免费看| 成人高清免费在线播放| 精品处破学生在线二十三| 午夜精品成人在线视频| 99久久综合99久久综合网站| 精品国精品国产| 日本欧美一区二区在线观看| 91蝌蚪porny| 国产精品久线观看视频| 韩国三级中文字幕hd久久精品| 3751色影院一区二区三区| 一区二区三区精品视频在线| 成人国产精品免费| 国产亚洲一本大道中文在线| 老司机午夜精品99久久| 正在播放亚洲一区| 同产精品九九九| 欧美性感一区二区三区| 亚洲制服丝袜一区| 色婷婷久久久综合中文字幕 | 久久人人97超碰com| 老司机免费视频一区二区 | 蜜桃视频在线观看一区| 亚洲国产精品av| 国产精品一二三区在线| 337p粉嫩大胆噜噜噜噜噜91av| 麻豆久久久久久久|