o
    0׾g                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ d Z	 Z
 Z ZZG dd deZd	d
 Zeee ddd ddlmZ eee ejd zejZW n eyY   e ZY nw edfddddZee_dS )a  Cooperative low-level networking interface.

This module provides socket operations and some related functions.
The API of the functions and classes matches the API of the corresponding
items in the standard :mod:`socket` module exactly, but the synchronous functions
in this module only block the current greenlet and let the others run.

For convenience, exceptions (like :class:`error <socket.error>` and :class:`timeout <socket.timeout>`)
as well as the constants from the :mod:`socket` module are imported into this module.
    )PY311)	exc_clear)copy_globals)_socket3 c                   @   s   e Zd ZdZdS )errorN)__name__
__module____qualname__errnor   r   r   W/var/www/html/backend_erp/backend_erp_env/lib/python3.10/site-packages/gevent/socket.pyr      s    r   c                  G   s   t  )N)NotImplementedError)argsr   r   r   getfqdn#   s   r   )__implements____dns____all____extensions____imports__
__socket__F)dunder_names_to_keepcleanup_globs)_socketcommon)
only_namesN)
all_errorsc                C   sX  t sd}| \}}g }tt||dt}|std|D ]}|\}	}
}}}d}zt|	|
|}|tur6|| |r=|| |	| W nV ty } z9|sQ|g}n|
| ~|dur_|  d}||d u r{|so|dd=  ztd||dd= w t  W Y d}~qd}~w ty   |dur|  d} w |dd= z|W d}  S d}w dS )a  
    create_connection(address, timeout=None, source_address=None, *, all_errors=False) -> socket

    Connect to *address* and return the :class:`gevent.socket.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.

    .. versionchanged:: 20.6.0
        If the host part of the address includes an IPv6 scope ID,
        it will be used instead of ignored, if the platform supplies
        :func:`socket.inet_pton`.
    .. versionchanged:: 22.08.0
        Add the *all_errors* argument. This only has meaning on Python 3.11+;
        it is a programming error to pass it on earlier versions.
    .. versionchanged:: 23.7.0
        You can pass a value for ``all_errors`` on any version of Python.
        It is forced to false for any version before 3.11 inside the function.
    Fr   z!getaddrinfo returns an empty listNzcreate_connection failed)r   listgetaddrinfoSOCK_STREAMr   socket_GLOBAL_DEFAULT_TIMEOUT
settimeoutbindconnectappendcloseExceptionGroupr   BaseException)addresstimeoutsource_addressr   hostport
exceptionsaddrsresafsocktypeproto
_canonnamesasockexcr   r   r   create_connection>   sZ   !






r7   )__doc__gevent._compatr   r   gevent._utilr   geventr   _sourcer   r   r   r   r   	Exceptionr   r   globalsr   r   r    AttributeErrorobjectr7   r   r   r   r   <module>   s2   


e