
    ,h                       d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlmZmZmZmZmZ d dlmZmZmZmZ ddlmZ ddlmZ ddlmZmZm Z m!Z!m"Z"m#Z# dd	l$m%Z% dd
l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2 ddlm3Z3m4Z4m5Z5 ddl6m7Z7m8Z8m9Z9 dgZ: G d dejv                        Z<	 d	 	 	 	 	 	 	 ddZ=de=_>        y)    )annotationsN)AsyncIterableAsyncIterator	AwaitableIterableMapping)AnyCallableDequecast   )asyncio_timeout)Headers)ConnectionClosedConnectionClosedErrorConnectionClosedOKInvalidStatePayloadTooBigProtocolError)	Extension)
OK_CLOSE_CODES	OP_BINARYOP_CLOSEOP_CONTOP_PINGOP_PONGOP_TEXTClose	CloseCodeOpcode)State)Data
LoggerLikeSubprotocol   )Frameprepare_ctrlprepare_dataWebSocketCommonProtocolc                     e Zd ZU dZded<   dZded<   ddddd	d
ddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d:dZd;dZd;dZd;dZ	e
d<d       Ze
d=d       Ze
d>d       Ze
d?d       Ze
d?d       Ze
d@d       Ze
d@d       Ze
d=d       Ze
d<d       ZdAdZdBdZ	 	 	 	 dCdZej0                  df	 	 	 	 	 dDdZd;d ZdEdFd!ZdGdHd"ZdId#Zd;d$Zd;d%ZdJd&Z dKd'Z!dLd(Z"dMd)Z#d;d*Z$e%jL                  d+	 	 	 	 	 	 	 	 	 dNd,Z'dEdOd-Z(d;d.Z)d;d/Z*d;d0Z+d@d1Z,ejZ                  df	 	 	 	 	 dDd2Z.d;d3Z/dPd4Z0dQd5Z1d;d6Z2d;d7Z3dRd8Z4d;d9Z5y)Sr)   uY  
    WebSocket connection.

    :class:`WebSocketCommonProtocol` provides APIs shared between WebSocket
    servers and clients. You shouldn't use it directly. Instead, use
    :class:`~websockets.legacy.client.WebSocketClientProtocol` or
    :class:`~websockets.legacy.server.WebSocketServerProtocol`.

    This documentation focuses on low-level details that aren't covered in the
    documentation of :class:`~websockets.legacy.client.WebSocketClientProtocol`
    and :class:`~websockets.legacy.server.WebSocketServerProtocol` for the sake
    of simplicity.

    Once the connection is open, a Ping_ frame is sent every ``ping_interval``
    seconds. This serves as a keepalive. It helps keeping the connection open,
    especially in the presence of proxies with short timeouts on inactive
    connections. Set ``ping_interval`` to :obj:`None` to disable this behavior.

    .. _Ping: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2

    If the corresponding Pong_ frame isn't received within ``ping_timeout``
    seconds, the connection is considered unusable and is closed with code 1011.
    This ensures that the remote endpoint remains responsive. Set
    ``ping_timeout`` to :obj:`None` to disable this behavior.

    .. _Pong: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3

    See the discussion of :doc:`keepalive <../../topics/keepalive>` for details.

    The ``close_timeout`` parameter defines a maximum wait time for completing
    the closing handshake and terminating the TCP connection. For legacy
    reasons, :meth:`close` completes in at most ``5 * close_timeout`` seconds
    for clients and ``4 * close_timeout`` for servers.

    ``close_timeout`` is a parameter of the protocol because websockets usually
    calls :meth:`close` implicitly upon exit:

    * on the client side, when using :func:`~websockets.legacy.client.connect`
      as a context manager;
    * on the server side, when the connection handler terminates.

    To apply a timeout to any other API, wrap it in :func:`~asyncio.timeout` or
    :func:`~asyncio.wait_for`.

    The ``max_size`` parameter enforces the maximum size for incoming messages
    in bytes. The default value is 1 MiB. If a larger message is received,
    :meth:`recv` will raise :exc:`~websockets.exceptions.ConnectionClosedError`
    and the connection will be closed with code 1009.

    The ``max_queue`` parameter sets the maximum length of the queue that
    holds incoming messages. The default value is ``32``. Messages are added
    to an in-memory queue when they're received; then :meth:`recv` pops from
    that queue. In order to prevent excessive memory consumption when
    messages are received faster than they can be processed, the queue must
    be bounded. If the queue fills up, the protocol stops processing incoming
    data until :meth:`recv` is called. In this situation, various receive
    buffers (at least in :mod:`asyncio` and in the OS) will fill up, then the
    TCP receive window will shrink, slowing down transmission to avoid packet
    loss.

    Since Python can use up to 4 bytes of memory to represent a single
    character, each connection may use up to ``4 * max_size * max_queue``
    bytes of memory to store incoming messages. By default, this is 128 MiB.
    You may want to lower the limits, depending on your application's
    requirements.

    The ``read_limit`` argument sets the high-water limit of the buffer for
    incoming bytes. The low-water limit is half the high-water limit. The
    default value is 64 KiB, half of asyncio's default (based on the current
    implementation of :class:`~asyncio.StreamReader`).

    The ``write_limit`` argument sets the high-water limit of the buffer for
    outgoing bytes. The low-water limit is a quarter of the high-water limit.
    The default value is 64 KiB, equal to asyncio's default (based on the
    current implementation of ``FlowControlMixin``).

    See the discussion of :doc:`memory usage <../../topics/memory>` for details.

    Args:
        logger: Logger for this server.
            It defaults to ``logging.getLogger("websockets.protocol")``.
            See the :doc:`logging guide <../../topics/logging>` for details.
        ping_interval: Interval between keepalive pings in seconds.
            :obj:`None` disables keepalive.
        ping_timeout: Timeout for keepalive pings in seconds.
            :obj:`None` disables timeouts.
        close_timeout: Timeout for closing the connection in seconds.
            For legacy reasons, the actual timeout is 4 or 5 times larger.
        max_size: Maximum size of incoming messages in bytes.
            :obj:`None` disables the limit.
        max_queue: Maximum number of incoming messages in receive buffer.
            :obj:`None` disables the limit.
        read_limit: High-water mark of read buffer in bytes.
        write_limit: High-water mark of write buffer in bytes.

    bool	is_client	undefinedstrsideN   i       i   F)loggerping_intervalping_timeoutclose_timeoutmax_size	max_queue
read_limitwrite_limithostportsecurelegacy_recvlooptimeoutc                  |rt        j                  dt               |d}nt        j                  dt               ||}|t        j                         }nt        j                  dt               || _        || _        || _        || _        || _	        || _
        || _        t        j                         | _        	 |t        j                   d      }t        j"                  |d| i      | _        	 |j'                  t        j(                        | _        || _        |	| _        |
| _        || _        || _        t        j6                  |dz  |      | _        d	| _        d | _        t        j>                         | _         tB        jD                  | _#        | j*                  r| j$                  j+                  d
       |  	 |  	 |  	 g | _$        d | _%        	 d | _&        d | _'        d | _(        |jS                         | _*        tW        jX                         | _-        d | _.        d | _/        d | _0        i | _1        d| _2        	 |  d | _3        |  |  y )Nzlegacy_recv is deprecated
   zrename timeout to close_timeoutzremove loop argumentzwebsockets.protocol	websocketr   )limitr>   Fz= connection is CONNECTINGr   )4warningswarnDeprecationWarningasyncioget_event_loopr3   r4   r5   r6   r7   r8   r9   uuiduuid4idlogging	getLoggerLoggerAdapterr2   isEnabledForDEBUGdebugr>   _host_port_securer=   StreamReaderreader_paused_drain_waiterLock_drain_lockr!   
CONNECTINGstate
extensionssubprotocol
close_rcvd
close_sentclose_rcvd_then_sentcreate_futureconnection_lost_waitercollectionsdequemessages_pop_message_waiter_put_message_waiter_fragmented_message_waiterpingslatencytransfer_data_exc)selfr2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   s                  \/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/websockets/legacy/protocol.py__init__z WebSocketCommonProtocol.__init__   s.   & MM57IJ ?GMM;=OP #M <))+DMM02DE*(* "$& "ZZ\B >&&'<=F")"7"7d@S"T) ((7
	

& **qtL :>"<<> %%
::KK:; 	401 ,./31 )-(,15! =A<N<N<P# &1%6%6%8@D @D  HL' HJ

	 	 8< 	 	    c                
  K   | j                   j                         rt        d      | j                  sy | j                  }||j                         sJ | j                  j                         }|| _        | d {    y 7 w)NzConnection lost)rc   doneConnectionResetErrorrW   rX   	cancelledr>   rb   rm   waiters     rn   _drain_helperz%WebSocketCommonProtocol._drain_helper0  sm     &&++-&'899||##~!1!1!33((*#s   A9B;B<Bc                  K   | j                   | j                   j                         }||| j                  7| j                  j                         rt	        j
                  d       d {    | j                          d {    y 7 7 w)Nr   )rV   	exception	transport
is_closingrG   sleeprw   rm   excs     rn   _drainzWebSocketCommonProtocol._drain<  su     ;;"++'')C	>>%~~((* mmA&&&  """ '"s$   A)B+B	,BBBBc                   | j                   t        j                  u sJ t        j                  | _         | j                  r| j
                  j	                  d       | j                  j                  | j                               | _	        | j                  j                  | j                               | _        | j                  j                  | j                               | _        y)z
        Callback when the WebSocket opening handshake completes.

        Enter the OPEN state and start the data transfer phase.

        z= connection is OPENN)r\   r!   r[   OPENrQ   r2   r>   create_tasktransfer_datatransfer_data_taskkeepalive_pingkeepalive_ping_taskclose_connectionclose_connection_taskrm   s    rn   connection_openz'WebSocketCommonProtocol.connection_openL  s     zzU----ZZ
::KK45"&))"7"78J8J8L"M#'99#8#89L9L9N#O %)YY%:%:4;P;P;R%S"rp   c                v    | j                   rdnd}t        j                  d| dt               | j                  S )Nremote_addresslocal_addressuse z[0] instead of host)r,   rD   rE   rF   rR   rm   alternatives     rn   r:   zWebSocketCommonProtocol.host_  3    *...&o[M)<=?QRzzrp   c                v    | j                   rdnd}t        j                  d| dt               | j                  S )Nr   r   r   z[1] instead of port)r,   rD   rE   rF   rS   r   s     rn   r;   zWebSocketCommonProtocol.porte  r   rp   c                N    t        j                  dt               | j                  S )Nzdon't use secure)rD   rE   rF   rT   r   s    rn   r<   zWebSocketCommonProtocol.securek  s    (*<=||rp   c                \    	 | j                   }|j                  d      S # t        $ r Y yw xY w)a(  
        Local address of the connection.

        For IPv4 connections, this is a ``(host, port)`` tuple.

        The format of the address depends on the address family;
        see :meth:`~socket.socket.getsockname`.

        :obj:`None` if the TCP connection isn't established yet.

        socknameNrz   get_extra_infoAttributeErrorrm   rz   s     rn   r   z%WebSocketCommonProtocol.local_addressr  7    	8I ++J77  		    	++c                \    	 | j                   }|j                  d      S # t        $ r Y yw xY w)a)  
        Remote address of the connection.

        For IPv4 connections, this is a ``(host, port)`` tuple.

        The format of the address depends on the address family;
        see :meth:`~socket.socket.getpeername`.

        :obj:`None` if the TCP connection isn't established yet.

        peernameNr   r   s     rn   r   z&WebSocketCommonProtocol.remote_address  r   r   c                t    | j                   t        j                  u xr | j                  j	                          S )a{  
        :obj:`True` when the connection is open; :obj:`False` otherwise.

        This attribute may be used to detect disconnections. However, this
        approach is discouraged per the EAFP_ principle. Instead, you should
        handle :exc:`~websockets.exceptions.ConnectionClosed` exceptions.

        .. _EAFP: https://docs.python.org/3/glossary.html#term-eafp

        )r\   r!   r   r   rr   r   s    rn   openzWebSocketCommonProtocol.open  s.     zzUZZ'N0G0G0L0L0N,NNrp   c                :    | j                   t        j                  u S )z
        :obj:`True` when the connection is closed; :obj:`False` otherwise.

        Be aware that both :attr:`open` and :attr:`closed` are :obj:`False`
        during the opening and closing sequences.

        )r\   r!   CLOSEDr   s    rn   closedzWebSocketCommonProtocol.closed  s     zzU\\))rp   c                    | j                   t        j                  ury| j                  t        j
                  S | j                  j                  S )z
        WebSocket close code, defined in `section 7.1.5 of RFC 6455`_.

        .. _section 7.1.5 of RFC 6455:
            https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5

        :obj:`None` if the connection isn't closed yet.

        N)r\   r!   r   r_   r   ABNORMAL_CLOSUREcoder   s    rn   
close_codez"WebSocketCommonProtocol.close_code  s=     ::U\\)__$---??'''rp   c                    | j                   t        j                  ury| j                  y| j                  j                  S )z
        WebSocket close reason, defined in `section 7.1.6 of RFC 6455`_.

        .. _section 7.1.6 of RFC 6455:
            https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6

        :obj:`None` if the connection isn't closed yet.

        N )r\   r!   r   r_   reasonr   s    rn   close_reasonz$WebSocketCommonProtocol.close_reason  s4     ::U\\)__$??)))rp   c               h   K   	 	 | j                          d{    7 # t        $ r Y yw xY ww)aU  
        Iterate on incoming messages.

        The iterator exits normally when the connection is closed with the close
        code 1000 (OK) or 1001 (going away) or without a close code.

        It raises a :exc:`~websockets.exceptions.ConnectionClosedError`
        exception when the connection is closed with any other code.

        N)recvr   r   s    rn   	__aiter__z!WebSocketCommonProtocol.__aiter__  s6     	 IIK'' '! 		s    2# !	# 	/2/2c                |  K   | j                   t        d      t        | j                        dk  r| j                  j                         }|| _         	 t        j                  || j                  gt        j                         d{    d| _         |j                         s%| j                  ry| j                          d{    t        | j                        dk  r| j                  j                         }| j                  "| j                  j                  d       d| _        |S 7 # d| _         w xY w7 uw)a  
        Receive the next message.

        When the connection is closed, :meth:`recv` raises
        :exc:`~websockets.exceptions.ConnectionClosed`. Specifically, it raises
        :exc:`~websockets.exceptions.ConnectionClosedOK` after a normal
        connection closure and
        :exc:`~websockets.exceptions.ConnectionClosedError` after a protocol
        error or a network failure. This is how you detect the end of the
        message stream.

        Canceling :meth:`recv` is safe. There's no risk of losing the next
        message. The next invocation of :meth:`recv` will return it.

        This makes it possible to enforce a timeout by wrapping :meth:`recv` in
        :func:`~asyncio.timeout` or :func:`~asyncio.wait_for`.

        Returns:
            A string (:class:`str`) for a Text_ frame. A bytestring
            (:class:`bytes`) for a Binary_ frame.

            .. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
            .. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

        Raises:
            ConnectionClosed: When the connection is closed.
            RuntimeError: If two coroutines call :meth:`recv` concurrently.

        NzPcannot call recv while another coroutine is already waiting for the next messager   )return_when)rg   RuntimeErrorlenrf   r>   rb   rG   waitr   FIRST_COMPLETEDrr   r=   ensure_openpopleftrh   
set_result)rm   pop_message_waitermessages      rn   r   zWebSocketCommonProtocol.recv  s,    < ##/:  $-- A%7;yy7N7N7P'9D$0 ll')@)@A ' 7 7  
 ,0(
 &**,## **,,,- $-- A%2 --'') ##/$$//5'+D$5
 ,0( -sC   AD<4D. D,	D. 7D<D:D<"A
D<,D. .	D77D<c                  K   | j                          d{    | j                  4t        j                  | j                         d{    | j                  4t	        |t
        t        t        t        f      r*t        |      \  }}| j                  d||       d{    yt	        |t              rt        d      t	        |t              rt        t        t           |      }t!        |      }	 t#        |      }t        |      \  }}| j&                  j)                         | _        	 | j                  d||       d{    |D ]?  }t        |      \  }}||k7  rt        d      | j                  dt*        |       d{    A | j                  dt*        d       d{    	 | j                  j7                  d       d| _        yt	        |t8              r% t        t:        t8        t           gt<        t           f   t?        |      j@                        |      }	  t        t:        t<        t           gtB        t           f   t?        |      jD                        |       d{   }t        |      \  }}| j&                  j)                         | _        	 | j                  d||       d{    |2 3 d{   }t        |      \  }}||k7  rt        d      | j                  dt*        |       d{    Gt        d      7 7 7 v# t$        $ r Y yw xY w7 7 7 # t,        t        j.                  f$ r! | j1                  t2        j4                          w xY w# | j                  j7                  d       d| _        w xY w7 '# tF        $ r Y yw xY w7 7 7 6 | j                  dt*        d       d{  7   n=# t,        t        j.                  f$ r! | j1                  t2        j4                          w xY w	 | j                  j7                  d       d| _        y# | j                  j7                  d       d| _        w xY ww)aZ	  
        Send a message.

        A string (:class:`str`) is sent as a Text_ frame. A bytestring or
        bytes-like object (:class:`bytes`, :class:`bytearray`, or
        :class:`memoryview`) is sent as a Binary_ frame.

        .. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
        .. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

        :meth:`send` also accepts an iterable or an asynchronous iterable of
        strings, bytestrings, or bytes-like objects to enable fragmentation_.
        Each item is treated as a message fragment and sent in its own frame.
        All items must be of the same type, or else :meth:`send` will raise a
        :exc:`TypeError` and the connection will be closed.

        .. _fragmentation: https://datatracker.ietf.org/doc/html/rfc6455#section-5.4

        :meth:`send` rejects dict-like objects because this is often an error.
        (If you want to send the keys of a dict-like object as fragments, call
        its :meth:`~dict.keys` method and pass the result to :meth:`send`.)

        Canceling :meth:`send` is discouraged. Instead, you should close the
        connection with :meth:`close`. Indeed, there are only two situations
        where :meth:`send` may yield control to the event loop and then get
        canceled; in both cases, :meth:`close` has the same effect and is
        more clear:

        1. The write buffer is full. If you don't want to wait until enough
           data is sent, your only alternative is to close the connection.
           :meth:`close` will likely time out then abort the TCP connection.
        2. ``message`` is an asynchronous iterator that yields control.
           Stopping in the middle of a fragmented message will cause a
           protocol error and the connection will be closed.

        When the connection is closed, :meth:`send` raises
        :exc:`~websockets.exceptions.ConnectionClosed`. Specifically, it
        raises :exc:`~websockets.exceptions.ConnectionClosedOK` after a normal
        connection closure and
        :exc:`~websockets.exceptions.ConnectionClosedError` after a protocol
        error or a network failure.

        Args:
            message: Message to send.

        Raises:
            ConnectionClosed: When the connection is closed.
            TypeError: If ``message`` doesn't have a supported type.

        NTzdata is a dict-like objectFz data contains inconsistent typesrp   z)data must be str, bytes-like, or iterable)$r   ri   rG   shield
isinstancer.   bytes	bytearray
memoryviewr(   write_framer   	TypeErrorr   r   r"   iternextStopIterationr>   rb   r   	ExceptionCancelledErrorfail_connectionr   INTERNAL_ERRORr   r   r
   r   typer   r   	__anext__StopAsyncIteration)rm   r   opcodedataiter_messagefragmentconfirm_opcodeaiter_messages           rn   sendzWebSocketCommonProtocol.send6  s    l     --9..!@!@AAA --9 gUIzBC'0LFD""4666 )899 *8D>73G=L- (1LFD.2ii.E.E.GD+7&&ufd;;; !- AH+7+A(ND%/'(JKK**5'4@@@	A &&tWc::: //::4@26/ /D--.d0CCDW'' M"mD12IdOCD'11"  "! ! (1LFD.2ii.E.E.GD+7&&ufd;;; '4 A A(+7+A(ND%/'(JKK**5'4@@@  GHHO 	!
 B 7  !  < A ;w556  $$Y%=%=>	 //::4@26/! &  <A A	 '4 &&tWc:::w556  $$Y%=%=>	 ; //::4@26/ //::4@26/sv  QL2Q	L
QAQL AQ3L >-Q,L0 L'AL0 L* L0 %L-&L0 +A9Q%AN -N.N 2-Q O 6N&7O =N,N(N,9O >N*?O QQQ	L$!Q#L$$Q'L0 *L0 -L0 0:M**M- -$NQN 	N# Q"N##Q&O (N,*O ,O O
O P/ :PP/ #Q/$QQr   c                  K   	 t        | j                        4 d{    | j                  t        ||             d{    ddd      d{    	 t        | j                        4 d{    | j                   d{    ddd      d{    t	        j                  | j                         d{    y7 7 7 s# 1 d{  7  sw Y   xY w# t        j
                  $ r | j                          Y w xY w7 7 7 t# 1 d{  7  sw Y   xY w# t        j
                  t        j                  f$ r Y w xY w7 w)ae  
        Perform the closing handshake.

        :meth:`close` waits for the other end to complete the handshake and
        for the TCP connection to terminate. As a consequence, there's no need
        to await :meth:`wait_closed` after :meth:`close`.

        :meth:`close` is idempotent: it doesn't do anything once the
        connection is closed.

        Wrapping :func:`close` in :func:`~asyncio.create_task` is safe, given
        that errors during connection termination aren't particularly useful.

        Canceling :meth:`close` is discouraged. If it takes too long, you can
        set a shorter ``close_timeout``. If you don't want to wait, let the
        Python process exit, then the OS will take care of closing the TCP
        connection.

        Args:
            code: WebSocket close code.
            reason: WebSocket close reason.

        N)r   r5   write_close_framer   rG   TimeoutErrorr   r   r   r   r   )rm   r   r   s      rn   closezWebSocketCommonProtocol.close  s,    8	#&t'9'9: B B,,U4-@AAAB B	 't'9'9: . .----. . nnT778881BAB B B B## 	#   "		# .-. . . .$$g&<&<= 		 	9s  E
C C C C CCC CC D /D0D 3D
DD
D DD "E
:E;E
 C CC CCCC #D>E
 DE
D D
D 
DDDD #EE
EE
c                ^   K   t        j                  | j                         d{    y7 w)a9  
        Wait until the connection is closed.

        This coroutine is identical to the :attr:`closed` attribute, except it
        can be awaited.

        This can make it easier to detect connection termination, regardless
        of its cause, in tasks that interact with the WebSocket connection.

        N)rG   r   rc   r   s    rn   wait_closedz#WebSocketCommonProtocol.wait_closed  s       nnT88999s   #-+-c                
  K   | j                          d{    |t        |      }|| j                  v rt        d      ||| j                  v r;t	        j
                  dt        j                  d            }|,|| j                  v r;| j                  j                         }t        j                         }||f| j                  |<   | j                  dt        |       d{    t        j                  |      S 7 7 w)aW  
        Send a Ping_.

        .. _Ping: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2

        A ping may serve as a keepalive, as a check that the remote endpoint
        received all messages up to this point, or to measure :attr:`latency`.

        Canceling :meth:`ping` is discouraged. If :meth:`ping` doesn't return
        immediately, it means the write buffer is full. If you don't want to
        wait, you should close the connection.

        Canceling the :class:`~asyncio.Future` returned by :meth:`ping` has no
        effect.

        Args:
            data: Payload of the ping. A string will be encoded to UTF-8.
                If ``data`` is :obj:`None`, the payload is four random bytes.

        Returns:
            A future that will be completed when the corresponding pong is
            received. You can ignore it if you don't intend to wait. The result
            of the future is the latency of the connection in seconds.

            ::

                pong_waiter = await ws.ping()
                # only if you want to wait for the corresponding pong
                latency = await pong_waiter

        Raises:
            ConnectionClosed: When the connection is closed.
            RuntimeError: If another ping was sent with the same data and
                the corresponding pong wasn't received yet.

        Nz-already waiting for a pong with the same dataz!Ir1   T)r   r'   rj   r   structpackrandomgetrandbitsr>   rb   timeperf_counterr   r   rG   r   )rm   r   pong_waiterping_timestamps       rn   pingzWebSocketCommonProtocol.ping  s     J    %D 4::NOO lddjj0;;tV%7%7%;<D lddjj0 ii--/**,'8

4tWd333~~k**) 	!$ 	4s/   DC?A%D=DAD%D&DDc                   K   | j                          d{    t        |      }| j                  dt        |       d{    y7 /7 w)a'  
        Send a Pong_.

        .. _Pong: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3

        An unsolicited pong may serve as a unidirectional heartbeat.

        Canceling :meth:`pong` is discouraged. If :meth:`pong` doesn't return
        immediately, it means the write buffer is full. If you don't want to
        wait, you should close the connection.

        Args:
            data: Payload of the pong. A string will be encoded to UTF-8.

        Raises:
            ConnectionClosed: When the connection is closed.

        NT)r   r'   r   r   rm   r   s     rn   pongzWebSocketCommonProtocol.pongT  sG     &    D!tWd333	 	! 	4s!   A
A)A
 AA
A
c                v   | j                   p| j                   j                  t        v rT| j                  H| j                  j                  t        v r,t	        | j                   | j                  | j
                        }n+t        | j                   | j                  | j
                        }| j                  |_        |S N)	r_   r   r   r`   r   ra   r   rl   	__cause__r}   s     rn   connection_closed_excz-WebSocketCommonProtocol.connection_closed_exco  s     OO'$$6+$$6$))C ())C ..
rp   c                >  K   | j                   t        j                  u rR| j                  j	                         r7t        j                  | j                         d{    | j                         y| j                   t        j                  u r| j                         | j                   t        j                  u r7t        j                  | j                         d{    | j                         | j                   t        j                  u sJ t        d      7 7 ?w)z
        Check that the WebSocket connection is open.

        Raise :exc:`~websockets.exceptions.ConnectionClosed` if it isn't.

        Nz*WebSocket connection isn't established yet)r\   r!   r   r   rr   rG   r   r   r   r   CLOSINGr[   r   r   s    rn   r   z#WebSocketCommonProtocol.ensure_open  s      ::# &&++-nnT%?%?@@@0022::%,,..::& ..!;!;<<<,,.. zzU----GHH' A =s%   ADDA?DD>DDc                  K   	 	 | j                          d{   }|y| j                  t        | j                        | j                  k\  rq| j                  j                         | _        	 t        j                  | j                         d{    d| _        t        | j                        | j                  k\  rq| j                  j                  |       | j                  "| j                  j                  d       d| _
        7 7 {# d| _        w xY w# t        j                  $ r}|| _         d}~wt        $ r0}|| _        | j                  t         j"                         Y d}~yd}~wt$        t&        t(        t*        j,                  f$ r0}|| _        | j                  t         j.                         Y d}~yd}~wt0        $ r0}|| _        | j                  t         j2                         Y d}~yd}~wt4        $ r0}|| _        | j                  t         j6                         Y d}~yd}~wt8        $ rM}| j:                  j=                  dd       || _        | j                  t         j>                         Y d}~yd}~ww xY ww)z
        Read incoming messages and put them in a queue.

        This coroutine runs in a task until the closing handshake is started.

        TNzdata transfer failedexc_info) read_messager7   r   rf   r>   rb   rh   rG   r   appendrg   r   r   rl   r   r   r   PROTOCOL_ERRORConnectionErrorr   EOFErrorsslSSLErrorr   UnicodeDecodeErrorINVALID_DATAr   MESSAGE_TOO_BIGr   r2   errorr   )rm   r   r~   s      rn   r   z%WebSocketCommonProtocol.transfer_data  s    =	; $ 1 1 33 ? >>-dmm,>37993J3J3L0<")..1I1I"JJJ7;D4 dmm,> $$W- ++7,,77=/3D,- 3 K7;D4 %% 	%(D"  	;%(D"  !9!9::xF 		= &)D"  !;!;<<! 	9%(D"  !7!788 	<%(D"  !:!:;; 	; KK4tD%(D"  !9!9::	;s   JD D
D JAD ."D DD )D ?AD D 	DD J-D55J&E,'J,&J&F=8J=J	&G4/J4J &H+&J+J7AI?:J?JJc                  K   | j                  | j                         d{   }|y|j                  t        k(  rd}n!|j                  t        k(  rd}nt        d      |j                  r(|r|j                  j                         S |j                  S g | j                  |r1t        j                  d      } |d      dfd	}ndfd
}ndfd}ndfd} ||       |j                  sZ| j                         d{   }|t        d      |j                  t        k7  rt        d       ||       |j                  sZ|rdj                        S dj                        S 7 V7 kw)z
        Read a single message from the connection.

        Re-assemble data frames if the message is fragmented.

        Return :obj:`None` when the closing handshake is started.

        )r6   NTFzunexpected opcodezutf-8strict)errorsc                p    j                  j                  | j                  | j                               y r   )r   decoder   fin)framedecoder	fragmentss    rn   r   z4WebSocketCommonProtocol.read_message.<locals>.append  s$    $$W^^EJJ		%JKrp   c                    j                  j                  | j                  | j                               t	        t
              sJ t        | j                        z  y r   )r   r   r   r   r   intr   )r   r   r  r6   s    rn   r   z4WebSocketCommonProtocol.read_message.<locals>.append  sC    $$W^^EJJ		%JK%h44EJJ/Hrp   c                <    j                  | j                         y r   )r   r   )r   r  s    rn   r   z4WebSocketCommonProtocol.read_message.<locals>.append  s    $$UZZ0rp   c                    j                  | j                         t        t              sJ t	        | j                        z  y r   )r   r   r   r  r   )r   r  r6   s    rn   r   z4WebSocketCommonProtocol.read_message.<locals>.append%  s4    $$UZZ0%h44EJJ/Hrp   zincomplete fragmented messager   rp   )r   r&   returnNone)read_data_framer6   r   r   r   r   r   r   r   codecsgetincrementaldecoderr   join)rm   r   textdecoder_factoryr   r   r  r6   s        @@@rn   r   z$WebSocketCommonProtocol.read_message  sj     **DMM*BB =<<7"D\\Y&D 344 99*.5::$$&>EJJ> !#	==$::7CO%X6GL0 0 10 	u))...AAE}#$CDD||w&#$7885M )) )))44)))44} Cn Bs)    F E;C,F E>AF %F >F c                  K   	 | j                  |       d{   }|j                  t        k(  rgt        j                  |j
                        | _        | j                  d| _        	 | j                  | j                  |j
                         d{    y|j                  t        k(  rA| j                  t        j                  u r	 | j                  |j
                         d{    n|j                  t         k(  r|j
                  | j"                  v rt%        j&                         }d}g }| j"                  j)                         D ]X  \  }\  }}|j+                  |       |j-                         s|j/                  ||z
         ||j
                  k(  sN||z
  | _         n t3        d      |D ]  }| j"                  |=  n|S 7 7 9# t        $ r Y yw xY w7 # t        $ r Y $w xY ww)z
        Read a single data frame from the connection.

        Process control frames received before the next data frame.

        Return :obj:`None` if a close frame is encountered before any data frame.

        NFz!solicited pong not found in pings)
read_framer   r   r   parser   r_   r`   ra   r   r   r   r\   r!   r   r   r   rj   r   r   itemsr   rr   r   rk   AssertionError)rm   r6   r   pong_timestampping_idping_idsr   r   s           rn   r  z'WebSocketCommonProtocol.read_data_frame7  s     //(33E ||x' #(++ejj"9??.05D- 00%**MMM (::+"ii

333
 (::+%)%6%6%8N #G!HBF**BRBRBT R>!>+~ 0*//1'22>N3RS"ejj0+9N+JDL!R --PQQ#+ 0 JJw/0
 g 3 N'  4+ s   G-GAG-()G G
G 0G-G %G&G *B+G-2G-
G 	GG-GG-G 	G*'G-)G**G-c                   K   t        j                  | j                  j                  | j                   || j
                         d{   }| j                  r| j                  j                  d|       |S 7 .w)z;
        Read a single frame from the connection.

        )maskr6   r]   Nz< %s)r&   readrV   readexactlyr,   r]   rQ   r2   )rm   r6   r   s      rn   r  z"WebSocketCommonProtocol.read_framev  sc     
 jjKK##^^#	
 
 ::KKfe,
s   AA9A7	/A9c                    t        |t        |      |      }| j                  r| j                  j                  d|       |j	                  | j
                  j                  | j                  | j                         y )Nz> %s)r  r]   )r&   r    rQ   r2   writerz   r,   r]   )rm   r   r   r   r   s        rn   write_frame_syncz(WebSocketCommonProtocol.write_frame_sync  s[    c6&>40::KKfe,NN   	 	
rp   c                .  K   	 | j                   4 d {    | j                          d {    d d d       d {    y 7 -7 7 	# 1 d {  7  sw Y   y xY w# t        $ r, | j                          | j	                          d {  7   Y y w xY wwr   )rZ   r   r   r   r   r   s    rn   drainzWebSocketCommonProtocol.drain  s     	% '' $ $kkm##$ $ $#$ $ $ $  	%  " ""$$$	%s   BA AA AAAA AA BA AA AAAA BA ,B	B
BBBB_statec                  K   | j                   |ur#t        d| j                   j                   d      | j                  |||       | j	                          d {    y 7 w)Nz#Cannot write to a WebSocket in the z state)r\   r   namer  r  )rm   r   r   r   r   s        rn   r   z#WebSocketCommonProtocol.write_frame  sY      ::V#5djjoo5FfM  	c640jjls   AA"A A"c                x  K   | j                   t        j                  u rt        j                  | _         | j                  r| j
                  j	                  d       || _        | j                  d| _        ||j                         }| j                  dt        |t        j                         d{    yy7 w)z
        Write a close frame if and only if the connection state is OPEN.

        This dedicated coroutine must be used for writing close frames to
        ensure that at most one close frame is sent on a given connection.

        = connection is CLOSINGNTr  )r\   r!   r   r   rQ   r2   r`   r_   ra   	serializer   r   )rm   r   r   s      rn   r   z)WebSocketCommonProtocol.write_close_frame  s      ::#DJzz!!";<#DO*,0)|( ""44"NNN $ Os   B/B:1B82B:c                  K   | j                   y	 	 t        j                  | j                          d{    | j                  j	                  d       | j                          d{   }| j                  T	 t        | j                        4 d{    | d{    ddd      d{    | j                  j	                  d       7 7 g7 >7 67 (# 1 d{  7  sw Y   8xY w# t        j                  $ rJ | j                  r| j                  j	                  d       | j                  t        j                  d       Y yw xY w# t        $ r Y yt        $ r  | j                  j                  dd       Y yw xY ww)	a>  
        Send a Ping frame and wait for a Pong frame at regular intervals.

        This coroutine exits when the connection terminates and one of the
        following happens:

        - :meth:`ping` raises :exc:`ConnectionClosed`, or
        - :meth:`close_connection` cancels :attr:`keepalive_ping_task`.

        NTz% sending keepalive pingz% received keepalive pongz&- timed out waiting for keepalive pongzkeepalive ping timeoutzkeepalive ping failedr   )r3   rG   r|   r2   rQ   r   r4   r   r   r   r   r   r   r   r   )rm   r   s     rn   r   z&WebSocketCommonProtocol.keepalive_ping  s`     %	FmmD$6$6777!!"<=$(IIK/$$0#243D3D#E . .
 #.--. . ))*EF 7 0.
 .. . . . #// :: KK--.VW,,%444    	 	FKK5E	Fs   F#E C2E 'C(E 9C, CC, CCC!C, ,C-C, E E C, CC, C)C C)%C, ,AE	E FE		E 	E?F%E?<F>E??Fc                  K   	 t        | d      r	 | j                   d{    t        | d      r| j                  j                          | j                  ret        | d      rY| j                          d{   r	 | j                          d{    y| j                  r| j                  j                  d       | j                  j                         r| j                  r| j                  j                  d       	 | j                  j                          | j                          d{   r	 | j                          d{    y| j                  r| j                  j                  d       | j                          d{    y7 j# t        j                  $ r Y ~w xY w7 17 # t        t        f$ r Y w xY w7 7 7 A# | j                          d{  7   w xY ww)a  
        7.1.1. Close the WebSocket Connection

        When the opening handshake succeeds, :meth:`connection_open` starts
        this coroutine in a task. It waits for the data transfer phase to
        complete then it closes the TCP connection cleanly.

        When the opening handshake fails, :meth:`fail_connection` does the
        same. There's no data transfer phase in that case.

        r   Nr   !- timed out waiting for TCP closezx half-closing TCP connection)hasattrr   rG   r   r   cancelr,   wait_for_connection_lostclose_transportrQ   r2   rz   can_write_eof	write_eofOSErrorr   r   s    rn   r   z(WebSocketCommonProtocol.close_connection  s    (	)t121111
 t23((//1 ~~'$0D"E668882 &&(((1 ::KK%%&IJ ~~++-::KK%%&EF
NN,,. 66888 &&((( ::KK%%&IJ
 &&(((I 2--  94 )  .  9 )($&&(((s   G&G F F
F AG 6F'7G <G&F*G&A(G >F- G +G,G 1G&GG&
'G 1G&GG&
F F$ G #F$$G *G&-F?<G >F??G G&G&G#GG##G&c                2  K   | j                   j                         r| j                  j                         ry| j                  r| j
                  j	                  d       | j                  j                          | j                          d{   ry| j                  r| j
                  j	                  d       | j                  r| j
                  j	                  d       | j                  j                          | j                          d{    y7 7 w)z,
        Close the TCP connection.

        Nzx closing TCP connectionr(  zx aborting TCP connection)	rc   rr   rz   r{   rQ   r2   r   r+  abortr   s    rn   r,  z'WebSocketCommonProtocol.close_transport%  s      &&++-$..2K2K2M ::KK89..000::KKAB ::KK9: ++--- 1 	.s%   B
DDB DDDDc                  K   | j                   j                         sV	 t        | j                        4 d{    t	        j
                  | j                          d{    ddd      d{    | j                   j                         S 7 U7 07 "# 1 d{  7  sw Y   2xY w# t        j                  $ r Y Jw xY ww)z
        Wait until the TCP connection is closed or ``self.close_timeout`` elapses.

        Return :obj:`True` if the connection is closed and :obj:`False`
        otherwise.

        N)rc   rr   r   r5   rG   r   r   r   s    rn   r+  z0WebSocketCommonProtocol.wait_for_connection_lostB  s      **//1*4+=+=> F F!..)D)DEEEF F **//11FEF F F F'' s   CB( BB( #BBB#B( .B/B( 3CB( BB( B%BB%!B( (B>;C=B>>Cc                x   | j                   r| j                  j                  d|       t        | d      r| j                  j	                          |t
        j                  k7  r| j                  t        j                  u rt        ||      }t        j                  | _        | j                   r| j                  j                  d       | j                  J || _        | j                  dt        |j!                                t        | d      s/| j"                  j%                  | j'                               | _        yy)a  
        7.1.7. Fail the WebSocket Connection

        This requires:

        1. Stopping all processing of incoming data, which means cancelling
           :attr:`transfer_data_task`. The close code will be 1006 unless a
           close frame was received earlier.

        2. Sending a close frame with an appropriate code if the opening
           handshake succeeded and the other side is likely to process it.

        3. Closing the connection. :meth:`close_connection` takes care of
           this once :attr:`transfer_data_task` exits after being canceled.

        (The specification describes these steps in the opposite order.)

        z!! failing connection with code %dr   r$  NTr   )rQ   r2   r)  r   r*  r   r   r\   r!   r   r   r   r_   r`   r  r   r%  r>   r   r   r   )rm   r   r   r   s       rn   r   z'WebSocketCommonProtocol.fail_connectionU  s    . ::KKA4H 4-.##**, 9---$**

2J$'E DJzz!!";<
 ??**#DO!!$%//2CD t45)-)>)>t?T?T?V)WD& 6rp   c                    | j                   t        j                  u sJ | j                         }| j                  j                         D ]&  \  }}|j                  |       |j                          ( y)z
        Raise ConnectionClosed in pending keepalive pings.

        They'll never receive a pong once the connection is closed.

        N)r\   r!   r   r   rj   valuesset_exceptionr*  )rm   r~   r   _ping_timestamps       rn   abort_pingsz#WebSocketCommonProtocol.abort_pings  sb     zzU\\))((*,0JJ,=,=,? 	!(K%%c*
  	!rp   c                    t        t        j                  |      }|j                  | j                         || _        | j                  j                  |       y)a  
        Configure write buffer limits.

        The high-water limit is defined by ``self.write_limit``.

        The low-water limit currently defaults to ``self.write_limit // 4`` in
        :meth:`~asyncio.WriteTransport.set_write_buffer_limits`, which should
        be all right for reasonable use cases of this library.

        This is the earliest point where we can get hold of the transport,
        which means it's the best point for configuring it.

        N)r   rG   	Transportset_write_buffer_limitsr9   rz   rV   set_transportr   s     rn   connection_madez'WebSocketCommonProtocol.connection_made  sE     **I6	))$*:*:;" 	!!),rp   c                   t         j                  | _        | j                  j	                  d       | j                          | j                  j                  d       	 | j                  8|| j                  j                          n| j                  j                  |       | j                  sy| j                  }|yd| _        |j                         ry||j                  d       y|j                  |       y)z=
        7.1.4. The WebSocket Connection is Closed.

        z= connection is CLOSEDN)r!   r   r\   r2   rQ   r8  rc   r   rV   feed_eofr6  rW   rX   rr   )rm   r~   rv   s      rn   connection_lostz'WebSocketCommonProtocol.connection_lost  s    
 \\
23
 	##..t4{{&;KK((*KK--c2 <<''F~!%D{{}{!!$'$$S)rp   c                .    | j                   rJ d| _         y )NT)rW   r   s    rn   pause_writingz%WebSocketCommonProtocol.pause_writing  s    <<rp   c                    | j                   sJ d| _         | j                  }|*d | _        |j                         s|j                  d        y y y )NF)rW   rX   rr   r   ru   s     rn   resume_writingz&WebSocketCommonProtocol.resume_writing  sM    ||##!%D;;=!!$' ! rp   c                :    | j                   j                  |       y r   )rV   	feed_datar   s     rn   data_receivedz%WebSocketCommonProtocol.data_received  s    d#rp   c                8    | j                   j                          y)a  
        Close the transport after receiving EOF.

        The WebSocket protocol has its own closing handshake: endpoints close
        the TCP or TLS connection after sending and receiving a close frame.

        As a consequence, they never need to write after receiving EOF, so
        there's no reason to keep the transport open by returning :obj:`True`.

        Besides, that doesn't work on TLS connections.

        N)rV   r?  r   s    rn   eof_receivedz$WebSocketCommonProtocol.eof_received  s     	rp   )r2   zLoggerLike | Noner3   float | Noner4   rJ  r5   rJ  r6   
int | Noner7   rK  r8   r  r9   r  r:   
str | Noner;   rK  r<   bool | Noner=   r+   r>   z asyncio.AbstractEventLoop | Noner?   rJ  r  r  )r  r  )r  rL  )r  rK  )r  rM  )r  r	   )r  r+   )r  zAsyncIterator[Data])r  r"   )r   z+Data | Iterable[Data] | AsyncIterable[Data]r  r  )r   r  r   r.   r  r  r   )r   Data | Noner  zAwaitable[float])rp   )r   r"   r  r  )r  r   )r  rN  )r6   rK  r  zFrame | None)r6   rK  r  r&   )r   r+   r   r  r   r   r  r  )
r   r+   r   r  r   r   r   r  r  r  )r   r   r   zbytes | Noner  r  )rz   zasyncio.BaseTransportr  r  )r~   zException | Noner  r  )r   r   r  r  )6__name__
__module____qualname____doc____annotations__r/   ro   rw   r   r   propertyr:   r;   r<   r   r   r   r   r   r   r   r   r   r   NORMAL_CLOSUREr   r   r   r   r   r   r   r   r  r  r  r  r!   r   r   r   r   r   r,  r+  r   r   r8  r=  r@  rB  rD  rG  rI   rp   rn   r)   r)   6   s   _H OD#
 %)&(%'&*$ $ "!15 $#O7 "O7 $	O7
 #O7 $O7 O7 O7 O7 O7 O7 O7 O7 O7  /!O7" #O7$ 
%O7d	# T&  
  
   8 8& 8 8& O O * * ( (" * *""L\]I<]I 
]IB ,,5959 59 
	59n:9+v46. IDD;LG5R=~
%  EJJJ		!$	,1	>A			O2+FZ4)l.:2* ..<X<X <X 
	<X|!(-*$*L($rp   c           
        t        |t        t        t        t        f      st        d      |r#t        j                  dd dk  rt        d      g }t        |      \  }}| D ]z  }|j                  t        j                  ur |j                  ;|rt        d      }j                  |       n|j                   j#                  d       g	 |j%                  d||       | |rrt3        d|      yy# t&        $ r{}|r$t        d	      }||_        j                  |       nJ|j                   j#                  d
t+        j,                  t/        |      |      d   j1                                Y d}~d}~ww xY w)a  
    Broadcast a message to several WebSocket connections.

    A string (:class:`str`) is sent as a Text_ frame. A bytestring or bytes-like
    object (:class:`bytes`, :class:`bytearray`, or :class:`memoryview`) is sent
    as a Binary_ frame.

    .. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
    .. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

    :func:`broadcast` pushes the message synchronously to all connections even
    if their write buffers are overflowing. There's no backpressure.

    If you broadcast messages faster than a connection can handle them, messages
    will pile up in its write buffer until the connection times out. Keep
    ``ping_interval`` and ``ping_timeout`` low to prevent excessive memory usage
    from slow connections.

    Unlike :meth:`~websockets.legacy.protocol.WebSocketCommonProtocol.send`,
    :func:`broadcast` doesn't support sending fragmented messages. Indeed,
    fragmentation is useful for sending large messages without buffering them in
    memory, while :func:`broadcast` buffers one copy per connection as fast as
    possible.

    :func:`broadcast` skips connections that aren't open in order to avoid
    errors on connections where the closing handshake is in progress.

    :func:`broadcast` ignores failures to write the message on some connections.
    It continues writing to other connections. On Python 3.11 and above, you may
    set ``raise_exceptions`` to :obj:`True` to record failures and raise all
    exceptions in a :pep:`654` :exc:`ExceptionGroup`.

    While :func:`broadcast` makes more sense for servers, it works identically
    with clients, if you have a use case for opening connections to many servers
    and broadcasting a message to them.

    Args:
        websockets: WebSocket connections to which the message will be sent.
        message: Message to send.
        raise_exceptions: Whether to raise an exception in case of failures.

    Raises:
        TypeError: If ``message`` doesn't have a supported type.

    zdata must be str or bytes-likeNr   )      z.raise_exceptions requires at least Python 3.11zsending a fragmented messagez/skipped broadcast: sending a fragmented messageTzfailed to write messagez.skipped broadcast: failed to write message: %sr   zskipped broadcast)r   r.   r   r   r   r   sysversion_info
ValueErrorr(   r\   r!   r   ri   r   r   r2   warningr  r   r   	tracebackformat_exception_onlyr   stripExceptionGroup)	
websocketsr   raise_exceptions
exceptionsr   r   rB   ry   write_exceptions	            rn   	broadcastrf  	  so   d gUIzBC899BQ')MNN
(LFD 	??%**,//;()GH	!!),  ((E 	&&tVT:> J0*== '  	()BC	&5	#!!),  ((D33_-' 	 	s   	C00	E49A0E//E4zwebsockets.legacy.server)F)rb  z!Iterable[WebSocketCommonProtocol]r   r"   rc  r+   r  r  )?
__future__r   rG   r	  rd   rL   r   r   r   rZ  r   r^  rI   rD   collections.abcr   r   r   r   r   typingr	   r
   r   r   asyncio.compatibilityr   datastructuresr   rd  r   r   r   r   r   r   r]   r   framesr   r   r   r   r   r   r   r   r   r    protocolr!   r"   r#   r$   framingr&   r'   r(   __all__Protocolr)   rf  rP  rV  rp   rn   <module>rq     s    "      
  
     V V - - 3 $  #    2 2 6 6 %
%Jg.. Jl. #\>1\>\> \> 
	\>@ 2	 rp   