⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pinet.h.html

📁 PTypes是一个扩充了多线程和网络功能的STL库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--Syntax highlighting generated by Web C Plus Plus software v0.8.2Webcpp Copyright (C)2001, (C)2002, (C)2003 Jeffrey Bakker under the GNU GPLGet webcpp at http://webcpp.sf.net--><html><head><title>pinet.h</title><style type="text/css">/*Webcpp v0.8.1 compatible StyleSheethttp://webcpp.sf.netTheme: ide-msvcpp*/body{background-color: #ffffff}.webcpp a:link    {color:#000000}.webcpp a:visited {color:#008000}.webcpp a:active  {color:#0000ff}.webcpp a:hover   {color:#0000ff}.webcpp pre{color: #000000}.webcpp font{font-size:100%}.webcpp .symbols{color: #000000}.webcpp .preproc{color: #0000ff}.webcpp .integer{color: #000000}.webcpp .floatpt{color: #000000}.webcpp .dblquot{color: #000000}.webcpp .sinquot{color: #000000}.webcpp .keyword{color: #0000ff;}.webcpp .keytype{color: #0000ff;}.webcpp .comment{color: #008000;}</style></head><body bgcolor="#FFFFFF" leftmargin="40" marginwidth="40"> <p><a href="../htsrc.html">Index</a><hr noshade></p><div class="webcpp"><pre><font CLASS=preproc>#ifndef</font> __PINET_H__ <font CLASS=preproc>#define</font> __PINET_H__ <font CLASS=preproc>#ifndef</font> __PPORT_H__ <font CLASS=preproc>#include</font> <font CLASS=dblquot>"pport.h"</font> <font CLASS=preproc>#endif</font> <font CLASS=preproc>#ifndef</font> __PTYPES_H__ <font CLASS=preproc>#include</font> <font CLASS=dblquot>"ptypes.h"</font> <font CLASS=preproc>#endif</font> <font CLASS=preproc>#ifndef</font> __PSTREAMS_H__ <font CLASS=preproc>#include</font> <font CLASS=dblquot>"pstreams.h"</font> <font CLASS=preproc>#endif</font> <font CLASS=preproc>#ifdef</font> WIN32 <font CLASS=preproc>#</font>  include &lt;winsock2.h&gt; <font CLASS=preproc>#else</font> <font CLASS=preproc>#</font>  include &lt;netdb.h&gt;       <font CLASS=comment>// for socklen_t </font><font CLASS=preproc>#</font>  include &lt;sys/types.h&gt; <font CLASS=preproc>#</font>  include &lt;sys/socket.h&gt; <font CLASS=preproc>#endif</font> PTYPES_BEGIN<font CLASS=preproc>#ifdef</font> _MSC_VER <font CLASS=preproc>#pragma</font> pack(push, <font CLASS=integer>4</font>) <font CLASS=preproc>#endif</font> <font CLASS=comment>//</font><font CLASS=comment>// BSD-compatible socket error codes for Win32</font><font CLASS=comment>//</font><font CLASS=preproc>#if</font> defined(WSAENOTSOCK) &amp;&amp; !defined(ENOTSOCK) <font CLASS=preproc>#define</font> EWOULDBLOCK             WSAEWOULDBLOCK <font CLASS=preproc>#define</font> EINPROGRESS             WSAEINPROGRESS <font CLASS=preproc>#define</font> EALREADY                WSAEALREADY <font CLASS=preproc>#define</font> ENOTSOCK                WSAENOTSOCK <font CLASS=preproc>#define</font> EDESTADDRREQ            WSAEDESTADDRREQ <font CLASS=preproc>#define</font> EMSGSIZE                WSAEMSGSIZE <font CLASS=preproc>#define</font> EPROTOTYPE              WSAEPROTOTYPE <font CLASS=preproc>#define</font> ENOPROTOOPT             WSAENOPROTOOPT <font CLASS=preproc>#define</font> EPROTONOSUPPORT         WSAEPROTONOSUPPORT <font CLASS=preproc>#define</font> ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT <font CLASS=preproc>#define</font> EOPNOTSUPP              WSAEOPNOTSUPP <font CLASS=preproc>#define</font> EPFNOSUPPORT            WSAEPFNOSUPPORT <font CLASS=preproc>#define</font> EAFNOSUPPORT            WSAEAFNOSUPPORT <font CLASS=preproc>#define</font> EADDRINUSE              WSAEADDRINUSE <font CLASS=preproc>#define</font> EADDRNOTAVAIL           WSAEADDRNOTAVAIL <font CLASS=preproc>#define</font> ENETDOWN                WSAENETDOWN <font CLASS=preproc>#define</font> ENETUNREACH             WSAENETUNREACH <font CLASS=preproc>#define</font> ENETRESET               WSAENETRESET <font CLASS=preproc>#define</font> ECONNABORTED            WSAECONNABORTED <font CLASS=preproc>#define</font> ECONNRESET              WSAECONNRESET <font CLASS=preproc>#define</font> ENOBUFS                 WSAENOBUFS <font CLASS=preproc>#define</font> EISCONN                 WSAEISCONN <font CLASS=preproc>#define</font> ENOTCONN                WSAENOTCONN <font CLASS=preproc>#define</font> ESHUTDOWN               WSAESHUTDOWN <font CLASS=preproc>#define</font> ETOOMANYREFS            WSAETOOMANYREFS <font CLASS=preproc>#define</font> ETIMEDOUT               WSAETIMEDOUT <font CLASS=preproc>#define</font> ECONNREFUSED            WSAECONNREFUSED <font CLASS=preproc>#define</font> ELOOP                   WSAELOOP <font CLASS=comment>// #define ENAMETOOLONG            WSAENAMETOOLONG</font><font CLASS=preproc>#define</font> EHOSTDOWN               WSAEHOSTDOWN <font CLASS=preproc>#define</font> EHOSTUNREACH            WSAEHOSTUNREACH <font CLASS=comment>// #define ENOTEMPTY               WSAENOTEMPTY</font><font CLASS=preproc>#define</font> EPROCLIM                WSAEPROCLIM <font CLASS=preproc>#define</font> EUSERS                  WSAEUSERS <font CLASS=preproc>#define</font> EDQUOT                  WSAEDQUOT <font CLASS=preproc>#define</font> ESTALE                  WSAESTALE <font CLASS=preproc>#define</font> EREMOTE                 WSAEREMOTE <font CLASS=comment>// NOTE: these are not errno constants in UNIX!</font><font CLASS=preproc>#define</font> HOST_NOT_FOUND          WSAHOST_NOT_FOUND <font CLASS=preproc>#define</font> TRY_AGAIN               WSATRY_AGAIN <font CLASS=preproc>#define</font> NO_RECOVERY             WSANO_RECOVERY <font CLASS=preproc>#define</font> NO_DATA                 WSANO_DATA <font CLASS=preproc>#endif</font> <font CLASS=comment>// shutdown() constants</font><font CLASS=preproc>#if</font> defined(SD_RECEIVE) &amp;&amp; !defined(SHUT_RD) <font CLASS=preproc>#</font>  define SHUT_RD       SD_RECEIVE <font CLASS=preproc>#</font>  define SHUT_WR       SD_SEND <font CLASS=preproc>#</font>  define SHUT_RDWR     SD_BOTH <font CLASS=preproc>#endif</font> <font CLASS=comment>// max backlog value for listen()</font><font CLASS=preproc>#ifndef</font> SOMAXCONN <font CLASS=preproc>#</font>  define SOMAXCONN <font CLASS=symbols>-</font><font CLASS=integer>1</font> <font CLASS=preproc>#endif</font> <font CLASS=keyword>typedef</font> <font CLASS=keytype>char</font>* sockval_t;<font CLASS=preproc>#ifndef</font> WIN32 <font CLASS=preproc>#</font>  define closesocket close <font CLASS=preproc>#endif</font> <font CLASS=preproc>#if</font> defined(__DARWIN__) <font CLASS=symbols>||</font> defined(WIN32)   <font CLASS=keyword>typedef</font> <font CLASS=keytype>int</font> psocklen;<font CLASS=preproc>#else</font>   <font CLASS=keyword>typedef</font> socklen_t psocklen;<font CLASS=preproc>#endif</font> <font CLASS=comment>// -------------------------------------------------------------------- //</font><font CLASS=comment>// ---  IP address class and DNS utilities ---------------------------- //</font><font CLASS=comment>// -------------------------------------------------------------------- //</font><font CLASS=comment>//</font><font CLASS=comment>// IP address</font><font CLASS=comment>//</font><font CLASS=keyword>struct</font> ipaddress{<font CLASS=preproc><font CLASS=keyword>public</font>:</font>    <font CLASS=keyword>union</font>    {        uchar   data[<font CLASS=integer>4</font>];        ulong   ldata;    };    ipaddress()                                 {}    ipaddress(ulong a)                          { ldata <font CLASS=symbols>=</font> a; }    ipaddress(<font CLASS=keyword>const</font> ipaddress&amp; a)               { ldata <font CLASS=symbols>=</font> a.ldata; }    ipaddress(<font CLASS=keytype>int</font> a, <font CLASS=keytype>int</font> b, <font CLASS=keytype>int</font> c, <font CLASS=keytype>int</font> d);    ipaddress&amp; <font CLASS=keyword>operator</font><font CLASS=symbols>=</font> (ulong a)              { ldata <font CLASS=symbols>=</font> a; <font CLASS=keyword>return</font> *<font CLASS=keyword>this</font>; }    ipaddress&amp; <font CLASS=keyword>operator</font><font CLASS=symbols>=</font> (<font CLASS=keyword>const</font> ipaddress&amp; a)   { ldata <font CLASS=symbols>=</font> a.ldata; <font CLASS=keyword>return</font> *<font CLASS=keyword>this</font>; }    uchar&amp; <font CLASS=keyword>operator</font> [] (<font CLASS=keytype>int</font> i)                  { <font CLASS=keyword>return</font> data[i]; }    <font CLASS=keyword>operator</font> ulong() <font CLASS=keyword>const</font>                      { <font CLASS=keyword>return</font> ldata; }};<font CLASS=keyword>extern</font> ipaddress ipnone;<font CLASS=keyword>extern</font> ipaddress ipany;<font CLASS=keyword>extern</font> ipaddress ipbcast;<font CLASS=comment>//</font><font CLASS=comment>// IP peer info: host name, IP and the port name</font><font CLASS=comment>// used internally in ipstream and ipmessage</font><font CLASS=comment>//</font><font CLASS=keyword>class</font> ippeerinfo: public noncopyable{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -