Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/usr/lib64/python2.7/socket.pyo

�
zfc@s�dZddlZddlTddlmZddlmZyddlZWnek
r_n�Xeed�Z	ddlm
ZddlmZm
Z
mZmZmZmZmZmZmZmZmZydd	lmZWnek
r�nXddlZddlZddlZydd
lmZWn!ek
rNdd
lmZnXyddlZWnek
rxeZnXeedd�Zeed
d�Z ddgZ!e!j"ej#e��e$Z%ej&j'�j(d�r�iZ)de)d<de)d<de)d<de)d<de)d<de)d<de)d<d e)d!<d"e)d#<d$e)d%<d&e)d'<d(e)d)<d*e)d+<d,e)d-<d.e)d/<e!j*d0�nd1d2�Z+d3d4d5d6d7d8d9d:d;d<d=d>d?d@fZ,ej-dAkr�e,dBfZ,nej&dCkre,dDfZ,ndEdFdGdHdIdJfZ.dKe/fdL��YZ0dMe/fdN��YZ1dO�Z2x]e,D]UZ3ee2e3�Z4e3e4_5ee%e3�je4_ee4ee1�Z6e7e1e3e6�qWWe1Z$Z8dPe/fdQ��YZ9e/�Z:e:edR�Z;dS(SsThis 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 and
                       optional source address.

 [*] 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*(tpartial(t
MethodTypecCs5ddl}tjdtdd�|j|||�S(Ni����s;socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.t
stackleveli(tssltwarningstwarntDeprecationWarningtsslwrap_simple(tsocktkeyfiletcertfilet_realssl((s/usr/lib64/python2.7/socket.pyR:s	
(tSSLError(tRAND_addtRAND_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(tRAND_egd(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�|j�}|s|dkr+t�}nyt|�\}}}Wntk
rWn8X|jd|�x$|D]}d|kroPqoqoW|}|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.(tstriptgethostnamet
gethostbyaddrterrortinsert(tnamethostnametaliasestipaddrs((s/usr/lib64/python2.7/socket.pyR�s	

tbindtconnectt
connect_extfilenotlistentgetpeernametgetsocknamet
getsockoptt
setsockopttsendalltsetblockingt
settimeoutt
gettimeouttshutdowntnttioctltriscost
sleeptaskwtrecvtrecvfromt	recv_intot
recvfrom_intotsendtsendtot
_closedsocketcBs7eZgZd�ZeZZZZZZ	eZ
RS(cGsttd��dS(NsBad file descriptor(R&R(targs((s/usr/lib64/python2.7/socket.pyt_dummy�s(t__name__t
__module__t	__slots__RFRBR>R@RCR?RAt__getattr__(((s/usr/lib64/python2.7/socket.pyRD�s	t
_socketobjectcBs�eZejZddgee�Zeeddd�Z
eeed�Z
ej
je
_d�Zejje_d�Zddd	�Zed
�dd�Zed
�dd�Zed�dd�ZRS(t_sockt__weakref__icCsX|dkr!t|||�}n||_x'tD]}t||t||��q1WdS(N(tNonet_realsocketRLt_delegate_methodstsetattrtgetattr(tselftfamilyttypetprotoRLtmethod((s/usr/lib64/python2.7/socket.pyt__init__�s
	
cCs=|�|_|jj}x|D]}||||�qWdS(N(RLRF(RSRDRPRQtdummyRW((s/usr/lib64/python2.7/socket.pytclose�s
cCs(|jj�\}}td|�|fS(NRL(RLtacceptRK(RSR	taddr((s/usr/lib64/python2.7/socket.pyR[�scCstd|j�S(sadup() -> socket object

        Return a new socket object connected to the same system resource.RL(RKRL(RS((s/usr/lib64/python2.7/socket.pytdup�stri����cCst|j||�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_fileobjectRL(RStmodetbufsize((s/usr/lib64/python2.7/socket.pytmakefile�scCs
|jjS(N(RLRT(RS((s/usr/lib64/python2.7/socket.pyt<lambda>�R!tdocsthe socket familycCs
|jjS(N(RLRU(RS((s/usr/lib64/python2.7/socket.pyRc�R!sthe socket typecCs
|jjS(N(RLRV(RS((s/usr/lib64/python2.7/socket.pyRc�R!sthe socket protocolN(RGRHROt__doc__tlistRPRItAF_INETtSOCK_STREAMRNRXRDRQRZR[R]RbtpropertyRTRURV(((s/usr/lib64/python2.7/socket.pyRK�s			cGst|j|�|�S(N(RRRL(R(RSRE((s/usr/lib64/python2.7/socket.pytmeth�sR_c
Bs�eZdZdZdZddddddd	d
ddg
Zd
ded�Zd�Ze	edd�Z
d�Zd�Zd�Z
d�Zd�Zd�Zdd�Zdd�Zdd�Zd�Zd�ZRS(s-Faux file object attached to a socket object.i s<socket>R`Rat	softspaceRLt	_rbufsizet	_wbufsizet_rbuft_wbuft	_wbuf_lent_closetrbi����cCs�||_||_|dkr*|j}n||_t|_|dkrTd|_n$|dkro|j|_n	||_||_t�|_	g|_
d|_||_dS(Nii(
RLR`tdefault_bufsizeRatFalseRkRlRmRRnRoRpRq(RSR	R`RaRZ((s/usr/lib64/python2.7/socket.pyRX�s 								cCs
|jdkS(N(RLRN(RS((s/usr/lib64/python2.7/socket.pyt
_getclosedsRdsTrue if the file is closedcCsDz|jr|j�nWd|jr6|jj�nd|_XdS(N(RLtflushRqRZRN(RS((s/usr/lib64/python2.7/socket.pyRZs		cCsy|j�WnnXdS(N(RZ(RS((s/usr/lib64/python2.7/socket.pyt__del__!scCs�|jr�dj|j�}g|_d|_t|j|j�}t|�}d}t|�}z<x5||kr�|jj	||||!�||7}qfWWd||kr�||}~~|jj
|�t|�|_nXndS(NR!i(RotjoinRptmaxRlRstlent
memoryviewRLR5tappend(RStdatatbuffer_sizet	data_sizetwrite_offsettviewt	remainder((s/usr/lib64/python2.7/socket.pyRv(s"			
cCs
|jj�S(N(RLR/(RS((s/usr/lib64/python2.7/socket.pyR/<scCs�t|�}|sdS|jj|�|jt|�7_|jdks�|jdkred|ks�|jdkr�|j|jkr�|j�ndS(Niis
(tstrRoR|RpRzRmRv(RSR}((s/usr/lib64/python2.7/socket.pytwrite?s!cCsxtdtt|��}|jttt|��7_|jj|�|j	dksg|j|j	krt|j
�ndS(Ni(tfilterRNtmapR�RptsumRzRotextendRmRv(RSRftlines((s/usr/lib64/python2.7/socket.pyt
writelinesJsc
Cs�t|j|j�}|j}|jdd�|dkr�t�|_xitr�y|jj|�}Wn/t	k
r�}|j
dtkr�qIn�nX|s�Pn|j|�qIW|j
�S|j�}||kr|jd�|j|�}t�|_|jj|j��|St�|_x�tr�||}y|jj|�}Wn/t	k
r|}|j
dtkrvq%n�nX|s�Pnt|�}	|	|kr�|r�|S|	|kr�|j|�~Pn|j|�||	7}~q%W|j
�SdS(Nii(RyRlRsRntseekRtTrueRLR>R&RERR�tgetvaluettelltreadRz(
RStsizetrbufsizetbufR}tetbuf_lentrvtlefttn((s/usr/lib64/python2.7/socket.pyR�TsZ		

	



c
Cs|j}|jdd�|j�dkr�|jd�|j|�}|jd�sht|�|kr�t�|_|jj|j��|S~n|dkrV|j	dkrp|jd�|j�g}t�|_d}|jj}xwt
rby:x3|dkr*|d�}|sPn|j|�q�WWn/tk
r]}|jdtkrWq�n�nXPq�Wdj|�S|jdd�t�|_x�t
rKy|jj|j	�}Wn/tk
r�}|jdtkr�q�n�nX|s�Pn|jd�}|dkr;|d7}|j|| �|jj||�~Pn|j|�q�W|j�S|jdd�|j�}	|	|kr�|jd�|j|�}
t�|_|jj|j��|
St�|_x=t
ry|jj|j	�}Wn/tk
r}|jdtkrq�n�nX|s*Pn||	}|jdd|�}|dkr�|d7}|jj||�|	r�|j|| �Pq�|| Snt|�}||kr�|	r�|S||kr�|j|| �|jj||�Pn|j|�|	|7}	q�W|j�SdS(Niis
iR!(RnR�R�treadlinetendswithRzRR�R�RlRNRLR>R�R|R&RERRxtfindR�(
RSR�R�tblinetbuffersR}R>R�tnlR�R�R�R�((s/usr/lib64/python2.7/socket.pyR��s�	
!
	
	


	


icCsfd}g}xStra|j�}|s+Pn|j|�|t|�7}|r||krPqqW|S(Ni(R�R�R|Rz(RStsizehintttotalRftline((s/usr/lib64/python2.7/socket.pyt	readliness	
cCs|S(N((RS((s/usr/lib64/python2.7/socket.pyt__iter__scCs|j�}|st�n|S(N(R�t
StopIteration(RSR�((s/usr/lib64/python2.7/socket.pytnexts	(RGRHReRsR(RIRtRXRuRitclosedRZRwRvR/R�R�R�R�R�R�R�(((s/usr/lib64/python2.7/socket.pyR_�s(										
Fi	cCs|\}}d}x�t||dt�D]�}|\}}}	}
}d}yYt|||	�}|tk	rz|j|�n|r�|j|�n|j|�|SWq(tk
r�}
|
}|dk	r�|j	�q�q(Xq(W|dk	r�|�ntd��dS(scConnect 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.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    A host of '' or port 0 tells the OS to use the default.
    is!getaddrinfo returns an empty listN(
RNtgetaddrinfoRhtsockett_GLOBAL_DEFAULT_TIMEOUTR7R,R-R&RZ(taddressttimeouttsource_addressthosttportterrtrestaftsocktypeRVt	canonnametsaR	t_((s/usr/lib64/python2.7/socket.pyRs(
	(<Ret_sockett	functoolsRttypesRt_ssltImportErrorRNRR
tsslerrorRRRRRRRRRRRRtostsysRt	cStringIORterrnoRRRRt__all__R�t_get_exports_listR�ROtplatformtlowert
startswithR R|Rt_socketmethodsR(RPtobjectRDRKRjt_mtpRGtmRQt
SocketTypeR_R�R(((s/usr/lib64/python2.7/socket.pyt<module>-s�

	L
$

















,	
	
�-	

Hacked By AnonymousFox1.0, Coded By AnonymousFox