Ñò §ÚêLc!@sSdZddkZddkTyddkZWnej onsXeed„ZddklZddklZl Z l Z l Z l Z l Z lZlZlZlZlZlZddkZddkZddkZyddklZWn#ej oddklZnXyddkZWnej o eZnXeedd ƒZeed d ƒZd d gZeieieƒƒe Z!ei"i#ƒi$dƒo­hZ%de%djoe(d?fZ(nei"d@joe(dAfZ(ndBdCdDdEdFdGfZ*dHe+fdI„ƒYZ,dJe+fdK„ƒYZ-e-Z Z.dL„Z/dMe+fdN„ƒYZ0e+ƒZ1e1dO„Z2dS(PsÛThis module provides socket operations and some related functions. On Unix, it supports IP (Internet Protocol) and Unix domain sockets. On other systems, it only supports IP. Functions specific for a socket are available as methods of the socket object. Functions: socket() -- create a new socket object socketpair() -- create a pair of new socket objects [*] fromfd() -- create a socket object from an open file descriptor [*] gethostname() -- return the current hostname gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) ssl() -- secure socket layer support (only available if configured) socket.getdefaulttimeout() -- get the default timeout value socket.setdefaulttimeout() -- set the default timeout value create_connection() -- connects to an address, with an optional timeout [*] not available on all platforms! Special objects: SocketType -- type object for socket objects error -- exception raised for I/O errors has_ipv6 -- boolean value indicating if IPv6 is supported Integer constants: AF_INET, AF_UNIX -- socket domains (first argument to socket() call) SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) Many other constants may be defined; these may be used in calls to the setsockopt() and getsockopt() methods. iÿÿÿÿN(t*cCs5ddk}tidtddƒ|i|||ƒS(Niÿÿÿÿs;socket.ssl() is deprecated. Use ssl.wrap_socket() instead.t stackleveli(tssltwarningstwarntDeprecationWarningtsslwrap_simple(tsocktkeyfiletcertfilet_realssl((s/usr/lib64/python2.6/socket.pyR7s   (tSSLError( tRAND_addtRAND_egdt RAND_statustSSL_ERROR_ZERO_RETURNtSSL_ERROR_WANT_READtSSL_ERROR_WANT_WRITEtSSL_ERROR_WANT_X509_LOOKUPtSSL_ERROR_SYSCALLt SSL_ERROR_SSLtSSL_ERROR_WANT_CONNECTt SSL_ERROR_EOFtSSL_ERROR_INVALID_ERROR_CODE(tStringIOtEBADFi tEINTRitgetfqdntcreate_connectiontwinsThe operation was interrupted.i'sA bad file handle was passed.i'sPermission denied.i's!A fault occurred on the network??i's#An invalid operation was attempted.i&'s The socket operation would blocki3's,A blocking operation is already in progress.i4'sThe network address is in use.i@'sThe connection has been reset.iF'sThe network has been shut down.iJ'sThe operation timed out.iL'sConnection refused.iM'sThe name is too long.iO'sThe host is down.iP'sThe host is unreachable.iQ'terrorTabtcCsš|iƒ}| p |djo tƒ}nyt|ƒ\}}}Wntj on;X|id|ƒx&|D]}d|joPqtqtW|}|S(sGet fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname from gethostname() is returned. s0.0.0.0it.(tstript gethostnamet gethostbyaddrterrortinsert(tnamethostnametaliasestipaddrs((s/usr/lib64/python2.6/socket.pyRys    tbindtconnectt connect_extfilenotlistent getpeernamet getsocknamet getsockoptt setsockopttsendallt setblockingt settimeoutt gettimeouttshutdowntnttioctltriscost sleeptaskwtrecvtrecvfromt recv_intot recvfrom_intotsendtsendtot _closedsocketcBs7eZgZd„ZeZZZZZZ eZ RS(cGsttdƒ‚dS(NsBad file descriptor(R$R(targs((s/usr/lib64/python2.6/socket.pyt_dummy¦s( t__name__t __module__t __slots__RDR@R<R>RAR=R?t __getattr__(((s/usr/lib64/python2.6/socket.pyRB¤s t _socketobjectcBsøeZeiZddgeeƒZeeddd„Z d„Z ei ie _d„Z ei ie _d„Z ddd „Zed „d d ƒZed „d dƒZed„d dƒZdZx&eD]ZeeeeefdUqÎW[[RS(t_sockt __weakref__icCsZ|djot|||ƒ}n||_x'tD]}t||t||ƒƒq3WdS(N(tNonet _realsocketRJt_delegate_methodstsetattrtgetattr(tselftfamilyttypetprotoRJtmethod((s/usr/lib64/python2.6/socket.pyt__init__¶s   cCs=tƒ|_|ii}xtD]}t|||ƒqWdS(N(RBRJRDRNRO(RQtdummyRU((s/usr/lib64/python2.6/socket.pytclose½s   cCs(|iiƒ\}}td|ƒ|fS(NRJ(RJtacceptRI(RQRtaddr((s/usr/lib64/python2.6/socket.pyRYÄscCstd|iƒS(sadup() -> socket object Return a new socket object connected to the same system resource.RJ(RIRJ(RQ((s/usr/lib64/python2.6/socket.pytdupÉstriÿÿÿÿcCst|i||ƒS(s¾makefile([mode[, bufsize]]) -> file object Return a regular file object corresponding to the socket. The mode and bufsize arguments are as for the built-in open() function.(t _fileobjectRJ(RQtmodetbufsize((s/usr/lib64/python2.6/socket.pytmakefileÏscCs |iiS((RJRR(RQ((s/usr/lib64/python2.6/socket.pytÖstdocsthe socket familycCs |iiS((RJRS(RQ((s/usr/lib64/python2.6/socket.pyRa×ssthe socket typecCs |iiS((RJRT(RQ((s/usr/lib64/python2.6/socket.pyRaØssthe socket protocolsVdef %s(self, *args): return self._sock.%s(*args) %s.__doc__ = _realsocket.%s.__doc__ N(RERFRMt__doc__tlistRNRGtAF_INETt SOCK_STREAMRLRVRXRYR[R`tpropertyRRRSRTt_st_socketmethodst_m(((s/usr/lib64/python2.6/socket.pyRI°s"    cCs7t|iƒdjo|idtjodSndS(Nii(tlenRCR(texc((s/usr/lib64/python2.6/socket.pyt_exception_was_EINTRâs R]c BsàeZdZdZdZddddddd d d d g Zd ded„Zd„Ze eddƒZ d„Z d„Z d„Z d„Zd„Zd„Zd„Zdd„Zdd„Zdd„Zd„Zd„ZRS( s-Faux file object attached to a socket object.i sR^R_t softspaceRJt _rbufsizet _wbufsizet_rbuft_wbuft _wbuf_lent_closetrbiÿÿÿÿcCs²||_||_|djo |i}n||_t|_|djo d|_n'|djo|i|_n ||_||_tƒ|_ g|_ d|_ ||_ dS(Nii( RJR^tdefault_bufsizeR_tFalseRnRoRpRRqRrRsRt(RQRR^R_RX((s/usr/lib64/python2.6/socket.pyRVós               cCs |idjS(N(RJRL(RQ((s/usr/lib64/python2.6/socket.pyt _getclosed sRbsTrue if the file is closedcCsHz|io|iƒnWd|io|iiƒnd|_XdS(N(RJtflushRtRXRL(RQ((s/usr/lib64/python2.6/socket.pyRXs   cCsy|iƒWnnXdS(N(RX(RQ((s/usr/lib64/python2.6/socket.pyt__del__sc Cs|iodi|iƒ}g|_d|_t|i|iƒ}t|ƒ}d}z~xw||joitiƒi i ƒzAt i oti ddtƒn|iit|||ƒƒWdQX||7}q[WWd||jo0||}~|ii|ƒt|ƒ|_nXndS(NRitignores.*buffer(RrtjoinRstmaxRoRvRkRtcatch_warningst__exit__t __enter__tsyst py3kwarningtfilterwarningsRRJR3tbuffertappend(RQtdatat buffer_sizet data_sizet write_offsett remainder((s/usr/lib64/python2.6/socket.pyRy!s*        "  cCs |iiƒS(N(RJR-(RQ((s/usr/lib64/python2.6/socket.pyR-8scCst|ƒ}|pdS|ii|ƒ|it|ƒ7_|idjp0|idjo d|jp|i|ijo|iƒndS(Niis (tstrRrR…RsRkRpRy(RQR†((s/usr/lib64/python2.6/socket.pytwrite;s cCs{tdtt|ƒƒ}|ittt|ƒƒ7_|ii|ƒ|i djp|i|i jo|i ƒndS(Ni( tfilterRLtmapR‹RstsumRkRrtextendRpRy(RQRdtlines((s/usr/lib64/python2.6/socket.pyt writelinesFs cCs|iS(N(Rs(RQ((s/usr/lib64/python2.6/socket.pyt _get_wbuf_lenPsc Cs"t|i|iƒ}|i}|iddƒ|djo„tƒ|_xjtoby|ii|ƒ}Wn,t j o }t |ƒoqJn‚nX|pPn|i |ƒqJW|i ƒS|i ƒ}||joC|idƒ|i|ƒ}tƒ|_|ii |iƒƒ|Stƒ|_xêtoâ||}y|ii|ƒ}Wn,t j o }t |ƒoq*n‚nX|pPnt|ƒ} | |jo | o|S| |jo|i |ƒ~Pn| |jptd|| f‚|i |ƒ|| 7}~q*W|i ƒSdS(Niisrecv(%d) returned %d bytes(R}RoRvRqtseekRtTrueRJR<R$RmRŒtgetvaluettelltreadRktAssertionError( RQtsizetrbufsizetbufR†tetbuf_lentrvtlefttn((s/usr/lib64/python2.6/socket.pyR˜Ss`               !  c Cs5|i}|iddƒ|iƒdjom|idƒ|i|ƒ}|idƒpt|ƒ|jo'tƒ|_|ii|iƒƒ|S~n|djo¿|i djoÅ|idƒ|iƒg}tƒ|_d}|i i }xzt ory>x7|djo)|dƒ}|pPn|i|ƒqWWn,tj o }t|ƒoqón‚nXPqóWdi|ƒS|iddƒtƒ|_xÀt o¸y|i i |i ƒ}Wn,tj o }t|ƒoqšn‚nX|pPn|idƒ}|djo7|d7}|i|| ƒ|ii||ƒ~Pn|i|ƒqšW|iƒS|iddƒ|iƒ} | |joC|idƒ|i|ƒ} tƒ|_|ii|iƒƒ| Stƒ|_xGt o?y|i i |i ƒ}Wn,tj o }t|ƒoqàn‚nX|pPn|| } |idd| ƒ}|djoG|d7}|ii||ƒ| o|i|| ƒPq®|| Snt|ƒ} | |jo | o|S| | jo*|i|| ƒ|ii|| ƒPn|i|ƒ| | 7} qàW|iƒSdS(Niis iR(RqR”R—treadlinetendswithRkRRŒR˜RoRLRJR<R•R…R$RmR|tfindR–( RQRšRœtblinetbuffersR†R<RtnlRžRŸR R¡((s/usr/lib64/python2.6/socket.pyR¢™s¶  #                          icCsmd}g}xZtoR|iƒ}|pPn|i|ƒ|t|ƒ7}|o||joPqqW|S(Ni(R•R¢R…Rk(RQtsizehintttotalRdtline((s/usr/lib64/python2.6/socket.pyt readliness   cCs|S(N((RQ((s/usr/lib64/python2.6/socket.pyt__iter__scCs!|iƒ}|p t‚n|S(N(R¢t StopIteration(RQRª((s/usr/lib64/python2.6/socket.pytnexts  (RERFRcRvR&RGRwRVRxRgtclosedRXRzRyR-RŒR’R“R˜R¢R«R¬R®(((s/usr/lib64/python2.6/socket.pyR]ès*        F i  c CsÒd}|\}}x°t||dtƒD]™}|\}}}} } d} yEt|||ƒ} |tj o| i|ƒn| i| ƒ| SWq(tj o$}| dj o| iƒqÁq(Xq(Wt|‚dS(s›Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. s!getaddrinfo returns an empty listiN( t getaddrinfoRfRLtsockett_GLOBAL_DEFAULT_TIMEOUTR5R+R$RX( taddressttimeouttmsgthosttporttrestaftsocktypeRTt canonnametsaR((s/usr/lib64/python2.6/socket.pyRs     (3Rct_sockett_sslt ImportErrorRLRR tsslerrorR R RRRRRRRRRRtosRRt cStringIORterrnoRPRRt__all__Rt_get_exports_listR±RMtplatformtlowert startswithRR…RRiR&RNtobjectRBRIt SocketTypeRmR]R²R(((s/usr/lib64/python2.6/socket.pyt,sx   R$                      0  ÿ3